Home > Articles

  • Print
  • + Share This
This chapter is from the book

This chapter is from the book

The Data Tier

But there's still a missing piece—the DataTier class library that's the subject of this chapter. Now that you've seen all of the places where its methods are called, you should be able to match up the calls from Listing 3.6 with the methods in Listing 3.7 and see how they fit together.

The data tier is a class used to instantiate an object called oDataTier in MAIN.PRG. Thereafter, any time we need to send data to a data store, we call a method on the oDataTier object.

It's important to note that in this methodology, you either open a DBF or a CURSOR for each table object. If you initiate either an Add or an Edit, you set buffering mode to 3, change something, and then call TableUpdate() and set Buffering back to 1. (If your user cancels, you refresh the screen with whatever was there before—the original, unchanged record. Tablerevert() does that, as long as you add a little code to go back to the record you were pointing to before the APPEND BLANK step.) If you were using FoxPro, you'd be home now.

However, if you're using SQL Server or an XML Web Service, you're only halfway there. You've done the equivalent in .NET of saving changes to a dataset. Now you need to use the saved data to update the data store, which might be on SQL Server or in Timbuktu. So we still need the TableUpdate() and TableRevert() function calls in the Save and Cancel buttons. We just have to add one more call to the DataTier object to see what else to do. If we're using DBFs, as you'll see, it simply excuses itself and returns. Similarly, in the form's Load event, we call the CreateCursor method of this object, which either creates a cursor, or, in the case of DBF access, opens the appropriate table and sets the index tag.

The proper way to read this code is to find the place in the form template code where each routine is being called, and then see what the DataTier routine does after the template code runs. It's the combination of the template code and the DataTier code that works the magic. Listing 3.7 shows the DataTier code.

Listing 3.7 DataTier.PRG

DEFINE CLASS DataTier AS Custom
AccessMethod = []
* Any attempt to assign a value to this property will be trapped
*            by the "setter" method AccessMethod_Assign.
ConnectionString = ;
 [Driver={SQL Server};Server=(local);Database=Mydatabase;UID=sa;PWD=;]
Handle    = 0

* Betcha didn't know you could write your own Assign methods...

PROCEDURE AccessMethod_Assign
PARAMETERS AM
DO CASE
  CASE AM = [DBF]
    THIS.AccessMethod = [DBF]  && FoxPro tables
  CASE AM = [SQL]
    THIS.AccessMethod = [SQL]  && MS Sql Server
    THIS.GetHandle
  CASE AM = [XML]
    THIS.AccessMethod = [XML]  && FoxPro XMLAdapter
  CASE AM = [WC]
    THIS.AccessMethod = [WC]   && WebConnection server
  OTHERWISE
    MESSAGEBOX( [Incorrect access method ] + AM, 16, [Setter error] )
    THIS.AccessMethod = []
ENDCASE
_VFP.Caption = [Data access method: ] + THIS.AccessMethod
ENDPROC

* CreateCursor actually opens the DBF if AccessMethod is DBF;
* otherwise it uses a structure returned from the data 
* store to create a cursor that is bound to the screen controls:

PROCEDURE CreateCursor
LPARAMETERS pTable, pKeyField
IF THIS.AccessMethod = [DBF]
  IF NOT USED ( pTable )
   SELECT 0
   USE ( pTable ) ALIAS ( pTable )
  ENDIF
  SELECT ( pTable )
  IF NOT EMPTY ( pKeyField )
   SET ORDER TO TAG ( pKeyField )
  ENDIF
  RETURN
ENDIF
Cmd = [SELECT * FROM ] + pTable + [ WHERE 1=2]
DO CASE
  CASE THIS.AccessMethod = [SQL]
    SQLEXEC( THIS.Handle, Cmd )
    AFIELDS ( laFlds )
    USE
    CREATE CURSOR ( pTable ) FROM ARRAY laFlds
  CASE THIS.AccessMethod = [XML]
  CASE THIS.AccessMethod = [WC]
ENDCASE

* GetHandle is called in the Assign method of the AccessMethod 
* property earlier in this listing (two procedures back).

PROCEDURE GetHandle
IF THIS.AccessMethod = [SQL]
  IF THIS.Handle > 0
   RETURN
  ENDIF
  THIS.Handle = SQLSTRINGCONNECT( THIS.ConnectionString )
  IF THIS.Handle < 1
   MESSAGEBOX( [Unable to connect], 16, [SQL Connection error], 2000 )
  ENDIF
 ELSE
  Msg = [A SQL connection was requested, but access method is ] ;
    + THIS.AccessMethod
  MESSAGEBOX( Msg, 16, [SQL Connection error], 2000 )
  THIS.AccessMethod = []
ENDIF
RETURN

PROCEDURE GetMatchingRecords
LPARAMETERS pTable, pFields, pExpr
pFields = IIF ( EMPTY ( pFields ), [*], pFields )
pExpr  = IIF ( EMPTY ( pExpr ), [], ;
     [ WHERE ] + STRTRAN ( UPPER ( ALLTRIM ( pExpr ) ), [WHERE ], [] ) )
cExpr  = [SELECT ] + pFields + [ FROM ] + pTable + pExpr
IF NOT USED ( pTable )
  RetVal = THIS.CreateCursor ( pTable )
ENDIF
DO CASE
  CASE THIS.AccessMethod = [DBF]
    &cExpr
  CASE THIS.AccessMethod = [SQL]
    THIS.GetHandle()
    IF THIS.Handle < 1
      RETURN
    ENDIF
    lr = SQLExec ( THIS.Handle, cExpr )
    IF lr >= 0
      THIS.FillCursor()
     ELSE
      Msg = [Unable to return records] + CHR(13) + cExpr
      MESSAGEBOX( Msg, 16, [SQL error] )
    ENDIF
ENDCASE
ENDPROC

In my EasySearch template, I open up a new cursor, the name of which is "View" followed by the name of the table that the data is coming from. So it's not a view, just a cursor name:

PROCEDURE CreateView
LPARAMETERS pTable
IF NOT USED( pTable )
  MESSAGEBOX( [Can't find cursor ] + pTable, 16, [Error creating view], 2000 )
  RETURN
ENDIF
SELECT ( pTable )
AFIELDS( laFlds )
SELECT 0
CREATE CURSOR ( [View] + pTable ) FROM ARRAY laFlds
ENDFUNC

GetOneRecord is called with all types of data stores. If we're using a DBF, a LOCATE command that refers to the current index tag is Rushmore-optimized and very fast. With SQL, it's also Rushmore-optimized, because SQL 2000 uses Rushmore—with not a single mention of where it came from. But we know...

PROCEDURE GetOneRecord
LPARAMETERS pTable, pKeyField, pKeyValue
SELECT ( pTable )
Dlm = IIF ( TYPE ( pKeyField ) = [C], ['], [] )
IF THIS.AccessMethod = [DBF]
  cExpr = [LOCATE FOR ] + pKeyField + [=] + Dlm + TRANSFORM ( pKeyValue ) + Dlm
 ELSE
  cExpr = [SELECT * FROM ] + pTable ;
     + [ WHERE ] + pKeyField + [=] + Dlm + TRANSFORM ( pKeyValue ) + Dlm
ENDIF
DO CASE
  CASE THIS.AccessMethod = [DBF]
    &cExpr
  CASE THIS.AccessMethod = [SQL]
    lr = SQLExec ( THIS.Handle, cExpr )
    IF lr >= 0
      THIS.FillCursor( pTable )
     ELSE
      Msg = [Unable to return record] + CHR(13) + cExpr
      MESSAGEBOX( Msg, 16, [SQL error] )
    ENDIF
  CASE THIS.AccessMethod = [XML]
  CASE THIS.AccessMethod = [WC]
ENDCASE
ENDFUNC

FillCursor is analogous to the Fill method of .NET's DataAdapters. FoxPro's ZAP is like the .NET DataAdapter.Clear method. By appending FROM DBF(CursorName) into the named cursor, we don't break the data binding with the form's controls:

PROCEDURE FillCursor
LPARAMETERS pTable
IF THIS.AccessMethod = [DBF]
  RETURN
ENDIF
SELECT ( pTable )
ZAP
APPEND FROM DBF ( [SQLResult] )
USE IN SQLResult
GO TOP
ENDPROC

I'd like to think that all primary keys were going to be integers, but legacy systems sometimes have character keys. That's what the check for delimiters is in the DeleteRecord routine:

PROCEDURE DeleteRecord
LPARAMETERS pTable, pKeyField
IF THIS.AccessMethod = [DBF]
  RETURN
ENDIF
KeyValue = EVALUATE ( pTable + [.] + pKeyField )
Dlm   = IIF ( TYPE ( pKeyField ) = [C], ['], [] )
DO CASE
  CASE THIS.AccessMethod = [SQL]
    cExpr = [DELETE ] + pTable + [ WHERE ] + pKeyField + [=] ;
       + Dlm + TRANSFORM ( m.KeyValue ) + Dlm
    lr = SQLExec ( THIS.Handle, cExpr )
    IF lr < 0
      Msg = [Unable to delete record] + CHR(13) + cExpr
      MESSAGEBOX( Msg, 16, [SQL error] )
    ENDIF
  CASE THIS.AccessMethod = [XML]
  CASE THIS.AccessMethod = [WC]
ENDCASE
ENDFUNC

The SaveRecord routine either does an INSERT or an UPDATE depending on whether the user was adding or not:

PROCEDURE SaveRecord
PARAMETERS pTable, pKeyField, pAdding
IF THIS.AccessMethod = [DBF]
  RETURN
ENDIF
IF pAdding
  THIS.InsertRecord ( pTable, pKeyField )
 ELSE
  THIS.UpdateRecord ( pTable, pKeyField )
ENDIF
ENDPROC

The InsertRecord and UpdateRecord routines call corresponding functions that build SQL INSERT or UPDATE commands, in much the same way that .NET does. I store the resulting string to _ClipText so that I can open up Query Analyzer and execute the command there manually to see what went wrong. It's the fastest way to debug your generated SQL code. Finally, I use SQLExec() to execute the command. SQLExec() returns -1 if there's a problem.

PROCEDURE InsertRecord
LPARAMETERS pTable, pKeyField
cExpr = THIS.BuildInsertCommand ( pTable, pKeyField )
_ClipText = cExpr
DO CASE
  CASE THIS.AccessMethod = [SQL]
    lr = SQLExec ( THIS.Handle, cExpr )
    IF lr < 0
      msg = [Unable to insert record; command follows:] + CHR(13) + cExpr
      MESSAGEBOX( Msg, 16, [SQL error] )
    ENDIF
  CASE THIS.AccessMethod = [XML]
  CASE THIS.AccessMethod = [WC]
ENDCASE
ENDFUNC

PROCEDURE UpdateRecord
LPARAMETERS pTable, pKeyField
cExpr = THIS.BuildUpdateCommand ( pTable, pKeyField )
_ClipText = cExpr
DO CASE
  CASE THIS.AccessMethod = [SQL]
    lr = SQLExec ( THIS.Handle, cExpr )
    IF lr < 0
      msg = [Unable to update record; command follows:] + CHR(13) + cExpr
      MESSAGEBOX( Msg, 16, [SQL error] )
    ENDIF
  CASE THIS.AccessMethod = [XML]
  CASE THIS.AccessMethod = [WC]
ENDCASE
ENDFUNC

FUNCTION BuildInsertCommand
PARAMETERS pTable, pKeyField
Cmd = [INSERT ] + pTable + [ ( ]
FOR I = 1 TO FCOUNT()
  Fld = UPPER(FIELD(I))
  IF TYPE ( Fld ) = [G]
    LOOP
  ENDIF
  Cmd = Cmd + Fld + [, ]
ENDFOR
Cmd = LEFT(Cmd,LEN(Cmd)-2) + [ } VALUES ( ]
FOR I = 1 TO FCOUNT()
  Fld = FIELD(I)
  IF TYPE ( Fld ) = [G]
    LOOP
  ENDIF
  Dta = ALLTRIM(TRANSFORM ( &Fld ))
  Dta = CHRTRAN ( Dta, CHR(39), CHR(146) )
*  get rid of single quotes in the data
  Dta = IIF ( Dta = [/ /], [], Dta )
  Dta = IIF ( Dta = [.F.], [0], Dta )
  Dta = IIF ( Dta = [.T.], [1], Dta )
  Dlm = IIF ( TYPE ( Fld ) $ [CM],['],;
     IIF ( TYPE ( Fld ) $ [DT],['],;
     IIF ( TYPE ( Fld ) $ [IN],[],  [])))
  Cmd = Cmd + Dlm + Dta + Dlm + [, ]
ENDFOR
Cmd = LEFT ( Cmd, LEN(Cmd) -2) + [ )] && Remove ", " add " )"
RETURN Cmd
ENDFUNC

FUNCTION BuildUpdateCommand
PARAMETERS pTable, pKeyField
Cmd = [UPDATE ] + pTable + [ SET ]
FOR I = 1 TO FCOUNT()
  Fld = UPPER(FIELD(I))
  IF Fld = UPPER(pKeyField)
    LOOP
  ENDIF
  IF TYPE ( Fld ) = [G]
    LOOP
  ENDIF
  Dta = ALLTRIM(TRANSFORM ( &Fld ))
  IF Dta = [.NULL.]
    DO CASE
     CASE TYPE ( Fld ) $ [CMDT]
        Dta = []
     CASE TYPE ( Fld ) $ [INL]
        Dta = [0]
    ENDCASE
  ENDIF
  Dta = CHRTRAN ( Dta, CHR(39), CHR(146) )
*   get rid of single quotes in the data
  Dta = IIF ( Dta = [/ /], [], Dta )
  Dta = IIF ( Dta = [.F.], [0], Dta )
  Dta = IIF ( Dta = [.T.], [1], Dta )
  Dlm = IIF ( TYPE ( Fld ) $ [CM],['],;
     IIF ( TYPE ( Fld ) $ [DT],['],;
     IIF ( TYPE ( Fld ) $ [IN],[],  [])))
  Cmd = Cmd + Fld + [=] + Dlm + Dta + Dlm + [, ]
ENDFOR
Dlm = IIF ( TYPE ( pKeyField ) = [C], ['], [] )
Cmd = LEFT ( Cmd, LEN(Cmd) -2 )      ;
  + [ WHERE ] + pKeyField + [=]     ;
  + + Dlm + TRANSFORM(EVALUATE(pKeyField)) + Dlm
RETURN Cmd
ENDFUNC

Sometimes I need to return a cursor that I'll use for my own purposes, for example, to load a combo box. I use the default name SQLResult. I only name it here because if I use FoxPro's SELECT, it returns the cursor into a BROWSE by default, and I need to ensure that the cursor name will be SQLResult when I return from this procedure:

PROCEDURE SelectCmdToSQLResult
LPARAMETERS pExpr
DO CASE
  CASE THIS.AccessMethod = [DBF]
     pExpr = pExpr + [ INTO CURSOR SQLResult]
    &pExpr
  CASE THIS.AccessMethod = [SQL]
    THIS.GetHandle()
    IF THIS.Handle < 1
      RETURN
    ENDIF
    lr = SQLExec ( THIS.Handle, pExpr )
    IF lr < 0
      Msg = [Unable to return records] + CHR(13) + cExpr
      MESSAGEBOX( Msg, 16, [SQL error] )
    ENDIF
  CASE THIS.AccessMethod = [XML]
  CASE THIS.AccessMethod = [WC]
ENDCASE
ENDFUNC

When I add a new record, whether I use DBFS or SQL, I'm responsible for inserting a unique value into the table. So I maintain a table of table names and the last key used. If you create this table manually, be sure to update the LastKeyVal field manually before going live, or you'll get thousands of duplicate keys.

FUNCTION GetNextKeyValue
LPARAMETERS pTable
EXTERNAL ARRAY laVal
pTable = UPPER ( pTable )
DO CASE

  CASE THIS.AccessMethod = [DBF]
    IF NOT FILE ( [Keys.DBF] )
      CREATE TABLE Keys ( TableName Char(20), LastKeyVal Integer )
    ENDIF
    IF NOT USED ( [Keys] )
      USE Keys IN 0
    ENDIF
    SELECT Keys
    LOCATE FOR TableName = pTable
    IF NOT FOUND()
      INSERT INTO Keys VALUES ( pTable, 0 )
    ENDIF
    Cmd = [UPDATE Keys SET LastKeyVal=LastKeyVal + 1 ]  ;
      + [ WHERE TableName='] + pTable + [']
    &Cmd
    Cmd = [SELECT LastKeyVal FROM Keys WHERE TableName = '] ;
      + pTable + [' INTO ARRAY laVal]
    &Cmd
    USE IN Keys
    RETURN TRANSFORM(laVal(1)) 

  CASE THIS.AccessMethod = [SQL]

    Cmd = [SELECT Name FROM SysObjects WHERE Name='KEYS' AND Type='U']
    lr = SQLEXEC( THIS.Handle, Cmd )
    IF lr < 0
      MESSAGEBOX( "SQL Error:"+ CHR(13) + Cmd, 16 )
    ENDIF
    IF RECCOUNT([SQLResult]) = 0
      Cmd = [CREATE TABLE Keys ( TableName Char(20), LastKeyVal Integer )]
      SQLEXEC( THIS.Handle, Cmd )
    ENDIF
    Cmd = [SELECT LastKeyVal FROM Keys WHERE TableName='] + pTable + [']
    lr = SQLEXEC( THIS.Handle, Cmd )
    IF lr < 0
      MESSAGEBOX( "SQL Error:"+ CHR(13) + Cmd, 16 )
    ENDIF
    IF RECCOUNT([SQLResult]) = 0
      Cmd = [INSERT INTO Keys VALUES ('] + pTable + [', 0 )]
      lr = SQLEXEC( THIS.Handle, Cmd )
      IF lr < 0
       MESSAGEBOX( "SQL Error:"+ CHR(13) + Cmd, 16 )
      ENDIF
    ENDIF
    Cmd = [UPDATE Keys SET LastKeyVal=LastKeyVal + 1 WHERE TableName='] ;
      + pTable + [']
    lr = SQLEXEC( THIS.Handle, Cmd )
    IF lr < 0
      MESSAGEBOX( "SQL Error:"+ CHR(13) + Cmd, 16 )
    ENDIF
    Cmd = [SELECT LastKeyVal FROM Keys WHERE TableName='] + pTable + [']
    lr = SQLEXEC( THIS.Handle, Cmd )
    IF lr < 0
      MESSAGEBOX( "SQL Error:"+ CHR(13) + Cmd, 16 )
    ENDIF
    nLastKeyVal = TRANSFORM(SQLResult.LastKeyVal)
    USE IN SQLResult
    RETURN TRANSFORM(nLastKeyVal)

  CASE THIS.AccessMethod = [WC]
  CASE THIS.AccessMethod = [XML]

ENDCASE

ENDDEFINE

Running the Application

Type

BUILD EXE Chapter3 FROM Chapter3

or use the Build button in the Project Manager. When you have an executable, run it and try each of the forms, as well as the search screens. It works pretty nicely, as we're used to seeing with DBF tables.

Now, select Change Data Source from the menu and enter SQL, as shown in Figure 3.4.

Figure 3.4Figure 3.4 Changing the data access method.

Now, open the Customer form. There's no data! That's standard for a SQL application because until the user requests a record, they don't have one yet. So click on Find, enter some search criteria (actually, to return all records, just leave them all blank), click on Show Matches, and select one. The search form disappears, and you've got data! Select Edit, and then change something and save it. Reload the page to verify that it worked. Add a record, save it, and see if the search form finds it.

Nothing special happens, except that you just built a FoxPro application that works with either DBFs or SQL without writing a single line of code in any of the forms.

  • + Share This
  • 🔖 Save To Your Account

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.

Overview


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information


To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.

Surveys

Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.

Newsletters

If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information


Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.

Security


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.

Children


This site is not directed to children under the age of 13.

Marketing


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information


If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.

Choice/Opt-out


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information


Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents


California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure


Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.

Links


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact


Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice


We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020