![]() |
Database Functions
Introduction
The database functions, found in /lib/db.mv and in /features/xxx/yyy_db.mv (where xxx is the product version and yyy is the three letter alpha code of the feature), allow you to perform common tasks such as finding records, reading and writing data. For more information about the structure of the database files, see Miva Merchant Database Reference Guide on the Miva Corporation Developer Resources web page, at http://www.miva.com/support/docs/api.
The standard practice for each function group, is to first open the database and all its indexes, and filter deleted records. These functions begin with _DB_Store_Open_X or _X_DB_Store_Open, where X is the name or partial name of the associated database.
Administration Functions
- The administration functions work with AdminSessions. These functions are in /lib/db.mv.
AdminSessions
AdminSession_Delete
Deletes the administration session defined by session_id.
AdminSession_Find_Session
Finds the administration session defined by session_id.
AdminSession_Insert
PARAMETERS = "session_id, user_id, lastupdate"
Creates an administration session and saves it to the database.
AdminSession_Update
PARAMETERS = "session_id, user_id, lastupdate"
Updates an administration session.
Affiliate
- The Affiliate functions work with Affiliates, AffiliateEarnings, AffiliatePayouts, AffiliateEmail, AffiliateManage, AffiliateOptions, and AffiliateSession as listed below. Functions are in: \features\aff\aff_db.mv
AFF_Create_Data_Files
Creates the Affiliate databases and index files.
Store_Create_A
Inserts StoreKey in Affiliates, AffiliateEarnings, and AffiliatePayouts, AffiliateEarningsVoid.
Store_Create_B
Creates the affiliates databases, associated index and memo files.
AFF_Store_Delete
Deletes the OrderOptions index file, Affiliates, AffiliateEarnings, AffiliatePayouts, AffiliateSession
AFF_Store_Pack
Packs each of the Affiliate databases.
AFF_Store_Close
Closes each of the Affiliate databases.
Affiliates
Affiliate_FindNext_AffiliateOrder
Finds the next record for id for corresponding login (code). INDEX: affil_i.mvx
Affiliate_FindPrev_AffiliateOrder
Finds the previous record for id for corresponding login (code). INDEX: affil_i.mvx
AffiliateLast_Payout_Update
PARAMETERS = "id, payout, payout_id, time"
Locates the record matching id, subtracts payout from balance, updates payout_id (lstpay_id), payout (lstpay_amt), time (lstpay_dt), and lstpay_by.
Affiliate_Update_Balance
PARAMETERS = "code, type, amt, by"
Checks if AffiliateOptions is active, locates record in Affiliates matching code, updates balance according to type and amt and updates by.
AffiliateVoid_Balance_Update
PARAMETERS = "id, void, old_void
Indexes on Affiliates id, if void is present, subtracts the AffiliateEarnings amount from Affiliates balance. If old_void is present, adds the AffiliateEarnings amount to Affiliates balance.
Affiliates_Delete
Removes the record containing the defined code.
Affiliates_Find_Code
Locates the record containing code.
Affiliates_Find_ID
Locates the record containing id.
Affiliates_Find_Session
Locates the record containing session_id.
Affiliates_FindFirst
Indexed on id, locates the first record (top row).
Affiliates_FindLast
Indexed on id, locates the last record (bottom row).
Affiliates_FindNext
Affiliates_FindNext_All
Locates the next record after offset.
Affiliates_FindOffset_All
Index on id, locates the records after offset, matching search.
Affiliates_Insert
PARAMETERS = "code, password, lpass, site_name, site_url, con_name, email, company, phone, fax, addr, city, state, zip, cntry, hits, percent, flat, status, session_id"
Writes a new record to Affiliates. Returns Affiliates id, if successful.
Affiliates_Update
PARAMETERS = "id, code, password, lpass, site_name, site_url, con_name, email, company, phone, fax, addr, city, state, zip, cntry, hits, percent, flat, status, status_by"
Locates the record matching id, and updates the record.
Affiliates_Update_ContactInfo
PARAMETERS = "id, code, lostemail, password, site_name, site_url, con_name, email, company, phone, fax, addr, city, state, zip, cntry"
Locates the record matching id, and updates the record.
Affiliates_Update_Session
PARAMETERS = "code, session_id"
Locates the record matching code, and updates the session_id.
AffiliateEarnings
Affiliate_Clean_Earnings
Indexes on aff_id, deletes the record matching id (aff_id).
AffiliateEarning_Find_AffiliateID
Indexes on aff_id, locates the record matching id (aff_id).
AffiliateEarning_FindNext_AffiliateID
Locates the next record matching id (aff_id).
AffiliateEarning_Find_PayoutID (4.0 only)
Note: 4.1x and above see AffiliateEarnings_Find_PayoutID
Indexes by payout_id, locates the record containing id (payout_id).
AffiliateEarning_FindNext_PayoutID (4.0 only)
Note: 4.1x and above see AffiliateEarnings_FindNext_PayoutID
Locates the next record matching id (payout_id).
AffiliateEarnings_Delete
Deletes the record matching id.
AffiliateEarnings_Find_ID
Locates the record matching id.
AffiliateEarnings_FindFirst
Locates the first (top) record.
AffiliateEarnings_FindFirst_Payout
Locates the first record matching payout_id.
AffiliateEarnings_FindNext
AffiliateEarnings_FindNext_Payout
Locates the next record matching payout_id.
AffiliateEarnings_FindNextOffset_Affiliate
PARAMETERS = "offset, affiliate_id"
Locates the next offset record for affiliate_id.
AffiliateEarnings_FindNextOffset_Payout
PARAMETERS = "offset, payout_id, search"
Locates the next offset record for payout_id.
AffiliateEarnings_FindOffset_Affiliate
PARAMETERS = "offset, affiliate_id
Locates the offset record for affiliate_id.
AffiliateEarnings_Find_PayoutID (4.1x and above)
Indexes by payout_id, locates the record containing id (payout_id).
AffiliateEarnings_FindNext_PayoutID (4.1x and above)
Locates the next record matching id (payout_id).
AffiliateEarnings_FindOffset_Payout
PARAMETERS = "offset, payout_id, search
Locates the offset record for payout_id.
AffiliateEarnings_Insert
PARAMETERS = "aff_id, type, order_id, order_amt, percent, amount, payout_id, ip_addr"
Writes a new record to AffiliateEarnings. Returns AffiliateEarnings id, if successful.
AffiliateEarningsVoid_Insert
PARAMETERS = "id, type, void, reas, order_id, order_amt, earned, by, date, ajst_rsn, ajst_by">
Writes a new record to AffiliateEarnings, voiding earnings (reas = void_reasn, earned = amount, by = void_by).
AffiliateEarningsVoid_Update
PARAMETERS = "id, void, reas, by"
Locates record matching id, and updates data for void, reas (void_reasn), and by (void_by).
AffiliatePayout_VoidEarnings_Update
PARAMETERS = "void, voidres, by"
Updates void, reas (void_reasn), and by (void_by).
AffiliateEmail
AffiliateEmail_Load
AffiliateEmail_Update
PARAMETERS = "from, cc, subject, header"
AffiliateManage
AffiliateManage_EmailLoad
AffiliateManage_Update
PARAMETERS = "activated, use_from, from, useto, to, use_cc, cc, subject, header"
AffiliateOptions
AffiliateOptions_Find
AffiliateOptions_Update
PARAMETERS = "activated, signup, hits, percent, flat, terms, pay_thresh, link_image, link_text"
Updates AffiliateOptions data.
AffiliatePayouts
AffiliatePayout_Delete
Indexes on id, deletes the record identified by id.
AffiliatePayouts_Find_ID
Locates the record matching id.
AffiliatePayouts_FindFirst
AffiliatePayouts_FindOffset_All
Indexes by date, locates the next offset payout records matching search.
AffiliatePayouts_FindOffset_Processed
Locates the next offset payout records matching search that are processed.
AffiliatePayouts_FindOffset_Unprocessed
Locates the offset payout records matching search that are not processed.
AffiliatePayouts_FindNext
AffiliatePayouts_FindNext_All
Locates the next offset records.
AffiliatePayouts_FindNext_Processed
Locate the next offset payout records matching search that are processed.
AffiliatePayouts_FindNext_Unprocessed
Locates the next offset payout records matching search that are not processed.
AffiliatePayouts_Insert
Writes a new record to AffiliatePayouts. (user = pay_by).
AffiliatePayouts_Process
Locates record matching id, and updates processed field to 1, to indicate it has been processed.
AffiliatePayouts_Update
PARAMETERS = "id, count, amount"
Locates record matching id, and updates count and amount.
AffiliatePayoutsVoid_Update
PARAMETERS = "id, processed, proc_by, proc_time, void, voidres, date, by"
Locates record matching id, and updates proc_time (processed date/time), void, voidres (void reason), by (void by).
AffiliateSession
Affiliate_Create_Order
PARAMETERS = "session_id, total"
Finds the affiliate session_id, checks that status is approved. Returns the value of the function "Affiliate_Update_Balance."
Affiliate_Delete_Session
Deletes Affiliates session for affil_code.
Affiliate_Find_SessionCode
PARAMETERS = "old_code, new_code
Updates the Affiliates code (password) from the old_code, to the new_code.
Affiliate_Insert_SessionID
Adds a record to AffiliateSession.
Bask_Delete
Deletes the record matching session_id from AffiliateSession.
BasketList_Update_Affiliate
PARAMETERS = "session_id, affil_code"
Finds session_id and updates affil_code.
Attribute Functions
- The attributes functions work with the data in the Attributes database. Functions are in: \lib\db.mv
Attributes
Attribute_Delete
Deletes the product attribute record defined by id.
Attribute_Find_Code
PARAMETERS = "product_id, code"
Finds the product attribute defined by product_id and code.
Attribute_Find_ID
Moves the record pointer to the record in the Attribute database as defined by id.
Attribute_FindFirst_Product
Finds the first record in the Attribute database that matches product_id.
Attribute_FindNext_Product
Finds the next record in the Attributes database.
Attribute_Insert
PARAMETERS = "product_id, code, type, template, prompt, price, cost, required, image"
Creates an attribute record in the Attributes database for the product defined in product_id and returns the attribute identification (attribute_id).
Attribute_Update
PARAMETERS = "id, default_id, code, type, template, prompt, price, cost, required, image"
Updates the data in the Attributes database for the attribute defined by id.
Attribute_Update_Order
Repositions the attribute in a display list based on the order parameter.
Product_Delete_Attributes (4.1x and above)
Deletes the record(s) matching the product id in the Attributes and Options databases. Includes function "AttributeTemplate_Decrement_ReferenceCount" when attribute `type' is template.
Attribute Template Functions
- Theses functions work with AttributeTemplate, AttributeTemplateAttributes, and AttributeTemplateOptions. Functions are in: \features\att\att_db.mv
AttributeTemplate
Attribute_Find_TemplateID
In Attributes (attr.dbf), locates the record matching attemp_id.
Attribute_FindFirst_ProductTemplate
PARAMETERS = "product_id, template_id"
In Attributes (attr.dbf), locates the first record matching the product_id and template_id.
AttributeTemplate_Copy
PARAMETERS = "template_id, product_id, nodups"
Copies the record containing the defined template_id and product_id.
AttributeTemplate_Decrement_ReferenceCount
Reduces the count for refcount, identifying the new number of products to which this template is assigned.
AttributeTemplate_Delete
Deletes the record defined by code.
AttributeTemplate_Find_Code
Locates the record defined by code.
AttributeTemplate_FindFirst
Locates the first (top) record in the database.
AttributeTemplate_Find_ID
Locates the record defined by id.
AttributeTemplate_FindNext
Locates the next record in the database.
AttributeTemplate_Increment_ReferenceCount
Increases the count for refcount, identifying the new number of products to which this template is assigned.
AttributeTemplate_Update
PARAMETERS = "old_code, code, prompt"
Updates the data for code and prompt in the AttributeTemplates record matching the defined old_code.
AttributeTemplates_Insert
Adds a new record to AttributeTemplates, inserting code and prompt fields.
AttributeTemplateAttributes
AttributeTemplateAttribute_Delete
Removes the record, defined by id.
AttributeTemplateAttribute_Find_Code
PARAMETERS = "template_id, code"
Locates the record defined by code.
AttributeTemplateAttribute_FindFirst_AttributeTemplate
Finds the first attribute template matching template_id (attemp_id).
AttributeTemplateAttribute_FindNext_AttributeTemplate
Finds the next attribute template matching template_id (attemp_id).
AttributeTemplateAttribute_Insert
PARAMETERS = "template_id, code, type, prompt, price, cost, required, image"
Adds a new record to AttributeTemplateAttributes and updates StoreKeys.
AttributeTemplateAttribute_Update
PARAMETERS = "id, default_id, code, type, prompt, price, cost, required, image
Updates the data in the record matching id.
AttributeTemplateAttribute_Update_Order
Updates order in the record matching id.
AttributeTemplates_FindFirst
Goes to the first (top) row of AttributeTemplates.
AttributeTemplates_FindFirst_Offset
Locates the first offset record.
AttributeTemplates_FindNext
Finds the next row, offset by 1.
AttributeTemplates_FindNext_All
Finds the next record, offset.
AttributeTemplates_FindOffset_All
AttributeTemplateOptions
AttributeTemplateOption_Delete
Removes the record matching the defined id.
AttributeTemplateOption_Find_Code
Locates the record matching the attribute template attribute ID, attr_id, and the defined code.
AttributeTemplateOption_Find_ID
Locates the record defined by id.
AttributeTemplateOption_FindFirst_Attribute
Locates the first record matching attr_id, Attribute Template Attribute ID (attmpat_id).
AttributeTemplateOption_FindNext_Attribute"
Locates the next record matching attr_id, Attribute Template Attribute ID (attmpat_id).
AttributeTemplateOption_Insert
PARAMETERS = "attmpat_id, code, prompt, price, cost, image"
Writes a new record to the database.
AttributeTemplateOption_Update
PARAMETERS = "id, code, prompt, price, cost, image
Updates the data for the record matching the defined id.
AttributeTemplateOption_Update_Order
Updates the order in the record matching id.
Availability Group Functions
- The availability groups functions work with the data in AvailabilityGroups, AvailabilityGroupXCategory, AvailabilityGroupXCustomer, and AvailabilityGroupXProduct. Functions are in: \features\agr\agr_db.mv
AvailabilityGroup
AvailabilityGroup_Category_FindNext_Assigned
PARAMETERS = "agrp_id, offset, search"
Finds the next category record that is assigned to the availability group agrp_id.
AvailabilityGroup_Category_FindNext_Unassigned
PARAMETERS = "agrp_id, offset, search"
Finds the next category record that is not assigned to the availability group agrp_id.
AvailabilityGroup_Category_FindOffset_Assigned
PARAMETERS = "agrp_id, offset, search"
Finds the offset of the next category record that is assigned to the availability group agrp_id.
AvailabilityGroup_Category_FindOffset_Unassigned
PARAMETERS = "agrp_id, offset, search"
Finds the offset of the next category record that is not assigned to the availability group agrp_id.
AvailabilityGroup_Customer_FindNext_Assigned
PARAMETERS = "agrp_id, offset, search"
Finds the next customer record that is assigned to the availability group agrp_id.
AvailabilityGroup_Customer_FindNext_Unassigned
Finds the next customer record that is not assigned to the availability group agrp_id.
PARAMETERS = "agrp_id, offset, search"
AvailabilityGroup_Customer_FindOffset_Assigned
PARAMETERS = "agrp_id, offset, search"
Finds the offset of the next customer record that is assigned to the availability group agrp_id.
AvailabilityGroup_Customer_FindOffset_Unassigned
PARAMETERS = "agrp_id, offset, search"
Finds the offset of the next customer record that is not assigned to the availability group agrp_id.
AvailabilityGroup_Delete
Deletes the availability group, as define by the parameter id, from the availability group database.
AvailabilityGroup_Find_ID
Sets the database pointer to the availability group record defined by the parameter id.
AvailabilityGroup_Find_Name
Finds the availability group record defined by the parameter name.
AvailabilityGroup_FindFirst
Finds the first availability group in the database.
AvailabilityGroup_FindFirst_Offset
Finds the offset defined by the parameter offset.
AvailabilityGroup_FindNext
Finds the next record in the availability group database.
AvailabilityGroup_Insert
Creates a new database record for an availability group as defined by name.
AvailabilityGroup_Product_FindNext_Assigned
PARAMETERS = "agrp_id, offset, search"
Finds the next product record that is assigned to the availability group agrp_id.
AvailabilityGroup_Product_FindNext_Unassigned
PARAMETERS = "agrp_id, offset, search"
Finds the next product record that is not assigned to the availability group agrp_id.
AvailabilityGroup_Product_FindOffset_Assigned
PARAMETERS = "agrp_id, offset, search"
Finds the offset of the next product record that is assigned to the availability group agrp_id.
AvailabilityGroup_Product_FindOffset_Unassigned
PARAMETERS = "agrp_id, offset, search"
Finds the offset of the next product record that is not assigned to the availability group agrp_id.
AvailabilityGroup_Update
Updates the name of the availability group in the database.
AvailabilityGroupXCategory
AvailabilityGroup_Category_Delete_AvailabilityGroupXCategory
Deletes the record from the AvailabilityGroupXCategory database matching the defined id for the category.
AvailabilityGroupXCategory_Delete
PARAMETERS = "agrp_id, cat_id"
Deletes the cat_id category from the agrp_id availability group database.
AvailabilityGroupXCategory_Find
PARAMETERS = "agrp_id, cat_id"
Finds the cat_id category in the agrp_id availability group.
AvailabilityGroupXCategory_FindFirst_Category
Finds the first category in the agrp_id availability group.
AvailabilityGroupXCategory_FindNext_Category
Finds the next category for the agrp_id availability group.
AvailabilityGroupXCategory_Insert
PARAMETERS = "cat_id, agrp_id"
Creates a record in the AvailabilityGroupXCategory database for cat_id and agrp_id.
AvailabilityGroupXCustomer
AvailabilityGroup_Customer_Find_ID_AvailabilityGroupXCategory_AND_AvailabilityGroupXCategory
Locates the record matching the defined cust_id and id.
AvailabilityGroupXCustomer_Delete
PARAMETERS = "agrp_id, cust_id"
Deletes the record in the AvailabilityGroupXCategory database for cat_id and agrp_id.
AvailabilityGroupXCustomer_Find
PARAMETERS = "agrp_id, cust_id"
Finds cust_id and agrp_id in the availabilityGroupXCustomer database.
AvailabilityGroupXCustomer_FindFirst_AvailabilityGroup
Finds the first record of the agrp_id availability group in the availabilityGroupXCustomer database.
AvailabilityGroupXCustomer_FindNext_AvailabilityGroup
Finds the next agrp_id availability group in AvailabilityGroupXCustomer database.
AvailabilityGroupXCustomer_Insert
PARAMETERS = "agrp_id, cust_id"
Creates a record in the AvailabilityGroupXCustomer database for cust_id and agrp_id.
AvailabilityGroupXProduct
AvailabilityGroup_Customer_Find_ID_AvailabilityGroupXCategory_AND_AvailabilityGroupXProduct
Locates the corresponding records in AvailabilityGroupXProduct and AvailabilityGroupXCustomer.
AvailabilityGroupXProduct_Delete
PARAMETERS = "agrp_id, product_id"
Deletes the agrp_id/product_id record from the AvailabilityGroupXProduct database.
AvailabilityGroupXProduct_Delete_Product
Deletes the record matching id.
AvailabilityGroupXProduct_Find
PARAMETERS = "agrp_id, product_id"
Sets the record pointer to agrp_id/product_id record of the AvailabilityGroupXProduct database.
AvailabilityGroupXProduct_Insert
PARAMETERS = "agrp_id, product_id"
Creates the agrp_id/product_id record in the availabilityGroupXProduct database.
Product_FindFirst_AvailabilityGroup
Locates the first product assigned to agrp_id in AvailabilityGroupXProduct.
Basket Functions
- The basket functions work with the data in the Baskets, BasketCharges, BasketList, BasketLastUpdate, and BasketOptions databases and related files. These functions are in lib\db.mv.
Baskets
Basket_Delete
Deletes the basket for the session_id passed to it.
Basket_Delete_AllLines
Deletes all basket items for the basket_id passed to it.
Basket_Delete_Line
Deletes a basket item based for the line_id passed to it.
Basket_Find_Line
Finds the line_id in a basket.
Basket_FindFirst_ID
Finds the first item in the basket (id) in the Baskets database.
Basket_FindNext_ID
Finds the first item in the basket (id) in the Baskets database.
Basket_Insert
PARAMETERS = "basket_id, product_id, code, name, price, weight, taxable, upsold, quantity"
Creates a record in the Baskets database for a basket and returns the basket line_id.
Basket_Quantity
PARAMETERS = "session_id, product_id"
Returns the quantity of product_id in session_id.
Basket_SubTotal (4.1x and above)
Returns the total of the products' prices, including options. (Does not includes tax or shipping.)
Basket_Total
Returns the total dollar value of the items in the basket attached to session_id.
Basket_TotalQuantity
Returns the total number of all items in the basket attached to session_id.
Basket_Update_Quantity
PARAMETERS = "line_id, quantity"
Updates the quantity of the basket item line_id with the amount quantity.
Basket_Weight
Returns the total weight of all items in the basket associated with session_id.
Store_DeleteBaskets
Deletes BasketOptions, Baskets, and BasketList.
BasketCharges
BasketCharge_DeleteAll_Module
PARAMETERS = "basket_id, module_id"
Deletes all charges in the basket defined by basket_id in module_id.
BasketCharge_FindFirst_Charge
Finds the first charge in the basket defined by basket_id.
BasketCharge_FindFirst_Module
PARAMETERS = "basket_id, module_id"
Finds the first charge in the basket defined by basket_id in module_id.
BasketCharge_FindFirst_Type
PARAMETERS = "basket_id, type"
Finds the first item type in basket_id.
BasketCharge_FindNext_Charge
Finds the next charge in the basket defined by basket_id.
BasketCharge_FindNext_Module
PARAMETERS = "basket_id, module_id"
Finds the next charge in the basket defined by basket_id in module_id.
BasketCharge_FindNext_Type
PARAMETERS = "basket_id, type"
Finds the next item type in basket_id.
BasketCharge_Insert
PARAMETERS = "basket_id, module_id, type, desc, amount, disp_amt, tax_exempt"
Creates a record for a charge to the basket.
BasketCharges_Delete_Type
PARAMETERS = "basket_id, type"
Deletes the item type in basket_id.
BasketLastUpdate
BasketLastUpdate_Update_LastUpdate
PARAMETERS = "session_id, lastupdate"
Updates lastupdate, time indicator for session_id.
BasketList
BasketList_FindFirst
Finds the first record in the Basketlist database.
BasketList_FindNext
Finds the next record in the Basketlist database.
BasketList_FindSession
Finds the session_id in the Basketlist database.
BasketList_Free_Order
Resets the values in session_id to zero and null.
BasketList_MakeDirty
Checks that basket contents remains the same throughout the checkout process for session_id.
BasketList_Insert
PARAMETERS = "session_id, lastupdate"
Creates a basket record for the session defined by session_id.
BasketList_Save_Order_Info
PARAMETERS = "session_id, ship_fname, ship_lname, ship_email, ship_comp, ship_phone, ship_fax, ship_addr, ship_city, ship_state, ship_zip, ship_cntry, bill_fname, bill_lname, bill_email, bill_comp, bill_phone, bill_fax, bill_addr, bill_city, bill_state, bill_zip, bill_cntry"
Saves shipping and billing data for the basket identified by session_id.
BasketList_Update_Customer
PARAMETERS = "session_id, cust_id"
Updates the customer identification (cust_id) for the session (session_id).
BasketList_Update_LastUpdate
PARAMETERS = "session_id, lastupdate"
Updates the lastupdate field of the basket (session_id).
BasketList_Update_Payment
PARAMETERS = "session_id, pay_id, pay_data"
Updates the pay information for the basket assigned to session_id.
BasketList_Update_Payment (4.14)
PARAMETERS = "session_id, pay_id, pay_data"
Updates the pay information for the basket assigned to session_id. Assigns BasketList.d.pay_data value of miva_array_serialize( l.pay_data).
BasketList_Update_PaymentSecure (new in 4.14)
PARAMETERS = "session_id, pay_secdat"
Updates the pay information for the basket assigned to session_id.
Checks if encryption is activated and secure data field has data, and updates BasketList accordingly.
BasketList_Update_Shipping
PARAMETERS = "session_id, shipping, ship_id, ship_data"
Updates the shipping information for the basket assigned to the session_id.
BasketList_Update_Tax
PARAMETERS = "session_id, tax"
Updates the sales tax amount for the basket assigned to the session_id.
BasketOptions
- Opens BasketOptions table, database and associated index files.
BasketOption_FindFirst_Line
Finds line_id in the Baskets database.
BasketOption_FindNext_Line
Finds the next line in the Baskets database.
BasketOption_Insert
PARAMETERS = "line_id, attr_id, attr_code, option_id, opt_code, data, price"
Finds the first line (line_id) for a product in the BasketOptions database and writes a record containing the following parameters.
Batch Functions
Batches
- The batch functions work with the data in the Batches database.
Batch_Create
Creates the name record in the Batches database.
Batch_Delete
Deletes the id batch from the Batches database.
Batch_Find_ID
Batch_FindFirst
Finds the first line in the Batches database.
Batch_FindNext
Finds the next line in the Batches database.
Category Functions
- The category functions work with the data in the Categories and CategoryXProduct databases. These functions are located in lib/db.mv.
Categories
The following functions work the Categories table, database and associated index files.
Category_Delete
Deletes the id category from the Categories database.
Category_Find_Code
Finds the code category in the Categories database.
Category_Find_ID
Category_FindFirst
Finds the first category in the Categories database.
Category_FindFirst_Offset
Finds the offset record in the Categories database.
Category_FindOffset_Search
Sets record pointer at the first record to match words beyond the record offset.
Category_FindFirst_Parent
Finds the category defined as parent_id in the Categories database.
Category_FindID_Parent
Finds the category defined as id in the Categories database.
Category_FindLast
Indexed by Categories.d.order, finds the last (bottom) row.
Category_FindNext
Finds the next record in the Categories database.
Category_FindNext_All
Finds the next record, increments the offset value by one and returns the new offset value, matching search.
Category_FindNext_CategoryOrder
Locates the next record matching code, and if found, assigns Primary Index as cat_ord.mvx.
Category_FindNext_Parent
Finds the next record of parent_id.
Category_FindOffset_All
Finds the offset record the Categories database. Search is the criteria entered by user.
Category_FindPrev_CategoryOrder
Locates the previous record matching code, and if found, assigns Primary Index as cat_ord.mvx.
Category_Insert
PARAMETERS = "parent_id, code, name, active"
Writes a new record to the Categories database.
Category_Product_FindNext_Assigned
PARAMETERS = "cat_id, offset, search"
Finds the next product assigned to cat_id.
Category_Product_FindNext_Unassigned
PARAMETERS = "cat_id, offset, search"
Finds the next product not assigned to cat_id.
Category_Product_FindOffset_Assigned
PARAMETERS = "cat_id, offset, search"
Finds the offset of the next product record that is assigned to cat_id.
Category_Product_FindOffset_Unassigned
PARAMETERS = "cat_id, offset, search"
Finds the offset of the next product record that is not assigned to cat_id.
Category_Sort
PARAMETERS = "sort_field, ascending"
Sorts the Categories database by sort_field and by order. "1" if ascending.
Category_Update
PARAMETERS = "id, parent_id, code, name, active"
Updates data fields in category record id.
Category_Update_Order
Updates the order of appearance of category id.
CategoryXProduct
- The following functions work the CategoryXProduct database and associated files.
CategoryXProduct_Delete
PARAMETERS = "cat_id, product_id"
Deletes record matching cat_id and product_id from CategoryXProduct. (And, decreases the catcount in Products.)
CategoryXProduct_Find
PARAMETERS = "cat_id, product_id"
Locates record matching cat_id and product_id in CategoryXProduct. (Index = cxp_cprd.mvx.)
CategoryXProduct_Insert
PARAMETERS = "cat_id, product_id"
Write a new record to the CategoryXProduct to assign the product, product_id, to category, cat_id. And, increases the catcount in Products.
CategoryXProduct_Sort
PARAMETERS = "category_id, sort_field, ascending"
Sorts the category_id in the CategoryXProduct database. sort_field is the field to sort on. "1" if ascending. (Creates a temporary database, CxPSort and index, which is removed after sort.)
CategoryXProduct_Update_Order
PARAMETERS = "cat_id, product_id, order"
Updates the order (placement) of product, product_id within category, cat_id. Primary Index = cxp_cprd.mvx.
Product_FindFirst_Category
Finds the first product within cat_id in CategoryXProduct.
Country Functions
- The country functions work with the data in the Countries database. These functions are located in lib/db.mv
Countries
Country_Find_Alpha
Finds the country record (alpha) in the country database.
Country_FindFirst
Finds first record in Countries database.
Country_FindNext
Finds next record in Countries database.
Country_FindNext_All
Finds the next Countries database record, increments the offset value by one and returns the new offset value
Country_FindOffset_All
Finds the offset records in the Countries database.
Country_Insert
PARAMETERS = "name, alpha, numeric"
Creates record in the Countries database for name. Name is Country name; alpha is Alpha country code; numeric is Numeric country code.
Customer Functions
- The customer functions work with the data in the Customers and CustomerEmail database and associated files.
Customers and Categories
- These work with Customers and Categories databases and associated files, and conditionally with AvailabilityGroup functions. These functions are located in lib\db.mv.
Customer_Category_Find_Code
Locates the record containing the active category's code, and returns the category id. If category belongs to an Availability Group, verifies it is enabled, locates the cust_id and code, and returns the category id.
Customer_Category_Find_ID
Locates the record containing the active category's id in Categories. If category belongs to an Availability Group, verifies it is enabled, locates the cust_id and id in AvailabilityGroupXCustomer and in AvailabilityGroupXCategory. Returns 1 if successful.
Customer_Category_Find_Name
Locates the records containing the active category id, and returns the category name. If category belongs to an Availability Group, verifies it is enabled, locates the cust_id and id, and returns the category name. Returns category relating AvailabilityGroupXCategory and AvailabilityGroupXCustomer.
Customer_Category_FindFirst_Parent
PARAMETERS = "cust_id, parent_id"
Locates the first record containing the active parent category, parent_id, in Categories. If category belongs to an Availability Group, verifies it is enabled, locates cust_id in AvailabilityGroupXCustomer and AvailabilityGroupXCategory. Returns 1 if successful.
Customer_Category_FindID_Parent
Locates the record containing the active category id, in Categories. If category belongs to an Availability Group, verifies it is enabled, locates cust_id and id in AvailabilityGroupXCustomer and AvailabilityGroupXCategory. Returns 1 if successful.
Customer_Category_FindNext_Parent
PARAMETERS = "cust_id, parent_id"
Locates the record containing the active parent category, parent_id, in Categories. If category belongs to an Availability Group, verifies it is enabled, locates cust_id in AvailabilityGroupXCustomer and AvailabilityGroupXCategory. Returns 1 if successful.
Customer_Category_FindFirst_Product
PARAMETERS = "cust_id, product_id"
Locates the first product_id and associated category in CategoryXProduct, and locates cust_id in AvailabilityGroupXCustomer and the associated `cat_id' and `agrp_id' in AvailabilityGroupXCategory.
Customer_Category_FindNext_Product
PARAMETERS = "cust_id, product_id"
Locates the next product_id and associated category in CategoryXProduct.
Finds the next category for customer (cust_id) that has the specific product (product_id) associated with it in Availability Group.
Customers
- These work with Customers database and associated files, and are located in /features/cus/cus_db.mv.
Customer_Delete
Deletes record matching id from the Customers database.
Customer_Find_ID
Locates the record matching id in the Customers database.
Customer_Find_Login
Locates the record in the Customers database that contains customer login name.
Customer_FindFirst
Locates the first customer in the Customers database.
Customer_FindFirst_Offset
Opens the Customer database and skips to the offset record.
Customer_FindLast
Indexed on id, goes to bottom row.
Customer_FindNext
Locates the next record after offset in the Customers database.
Customer_FindNext_All
Locates the next record after offset in the Customer database.
Customer_FindNext_CustomerID
Skips to next row after Customer_Find_ID.
Customer_FindNext_Words
Locates the next record in the Customers database.
Customer_FindPrev_CustomerID
Skips to previous row after Customer_Find_ID.
Customer_FindOffset_Words
Finds the offset records defined by the search criteria (words).
Customer_FindOffset_All
Locates the record defined by search after the offset in the Customers database.
Customer_Insert
PARAMETERS = "login, pw_email, password, ship_fname, ship_lname, ship_email, ship_comp, ship_phone, ship_fax, ship_addr, ship_city, ship_state, ship_zip, ship_cntry, bill_fname, bill_lname, bill_email, bill_comp, bill_phone, bill_fax, bill_addr, bill_city, bill_state, bill_zip, bill_cntry"
Writes a new customer record in the Customers database.
Customer_Update
PARAMETERS = "id, login, pw_email, password, ship_fname, ship_lname, ship_email, ship_comp, ship_phone, ship_fax, ship_addr, ship_city, ship_state, ship_zip, ship_cntry, bill_fname, bill_lname, bill_email, bill_comp, bill_phone, bill_fax, bill_addr, bill_city, bill_state, bill_zip, bill_cntry"
Updates the data in a customer record.
Customers and Products
Customer_Product_Find_Code
Determines if the product (code) and customer (cust_id) are part of the same availability group.
Customer_Product_Find_ID