Skip to content

Commit

Permalink
Update documentation (#31)
Browse files Browse the repository at this point in the history
  • Loading branch information
heaths authored Feb 17, 2024
1 parent ab28086 commit cd7a2de
Show file tree
Hide file tree
Showing 18 changed files with 34 additions and 32 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2022 Heath Stewart.
# Copyright 2024 Heath Stewart.
# Licensed under the MIT License. See LICENSE.txt in the project root for license information.

name: ci
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2022 Heath Stewart.
# Copyright 2024 Heath Stewart.
# Licensed under the MIT License. See LICENSE.txt in the project root for license information.

name: release
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2022 Heath Stewart.
# Copyright 2024 Heath Stewart.
# Licensed under the MIT License. See LICENSE.txt in the project root for license information.

[package]
Expand Down
2 changes: 1 addition & 1 deletion LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright 2022 Heath Stewart
Copyright 2024 Heath Stewart

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ pub extern "C" fn MyCustomAction(session: Session) -> CustomActionResult {

## License

This project is licensed under the [MIT license](LICENSE.txt).
This project is licensed under the [MIT license](https://github.com/heaths/msica-rs/blob/main/LICENSE.txt).

[automation interface]: https://docs.microsoft.com/windows/win32/msi/automation-interface
[custom actions]: https://docs.microsoft.com/windows/win32/msi/custom-actions
Expand Down
2 changes: 1 addition & 1 deletion examples/deferred/deferred.wxs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<!--
Copyright 2022 Heath Stewart.
Copyright 2024 Heath Stewart.
Licensed under the MIT License. See LICENSE.txt in the project root for license information.
-->
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
Expand Down
2 changes: 1 addition & 1 deletion examples/deferred/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2022 Heath Stewart.
// Copyright 2024 Heath Stewart.
// Licensed under the MIT License. See LICENSE.txt in the project root for license information.

use msica::prelude::*;
Expand Down
2 changes: 1 addition & 1 deletion examples/example.wxs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<!--
Copyright 2022 Heath Stewart.
Copyright 2024 Heath Stewart.
Licensed under the MIT License. See LICENSE.txt in the project root for license information.
-->

Expand Down
2 changes: 1 addition & 1 deletion examples/skip/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2022 Heath Stewart.
// Copyright 2024 Heath Stewart.
// Licensed under the MIT License. See LICENSE.txt in the project root for license information.

use msica::prelude::*;
Expand Down
2 changes: 1 addition & 1 deletion examples/skip/skip.wxs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<!--
Copyright 2022 Heath Stewart.
Copyright 2024 Heath Stewart.
Licensed under the MIT License. See LICENSE.txt in the project root for license information.
-->
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
Expand Down
2 changes: 1 addition & 1 deletion src/database.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2022 Heath Stewart.
// Copyright 2024 Heath Stewart.
// Licensed under the MIT License. See LICENSE.txt in the project root for license information.

use crate::ffi;
Expand Down
2 changes: 1 addition & 1 deletion src/error.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2022 Heath Stewart.
// Copyright 2024 Heath Stewart.
// Licensed under the MIT License. See LICENSE.txt in the project root for license information.

use crate::Record;
Expand Down
4 changes: 2 additions & 2 deletions src/error/experimental.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2022 Heath Stewart.
// Copyright 2024 Heath Stewart.
// Licensed under the MIT License. See LICENSE.txt in the project root for license information.

#![cfg(feature = "nightly")]
Expand All @@ -11,7 +11,7 @@ use std::ops::{ControlFlow, FromResidual, Try};

/// A result to return from a custom action.
///
/// This allows you to use the `?` operator to map any `Result<T, E>` to [`CustomActionResult::Fail`].
/// This allows you to use the `?` operator to map any `Result<T, E>` to [`CustomActionResult::Failure`].
///
/// # Example
///
Expand Down
2 changes: 1 addition & 1 deletion src/ffi.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2022 Heath Stewart.
// Copyright 2024 Heath Stewart.
// Licensed under the MIT License. See LICENSE.txt in the project root for license information.

#![allow(clippy::upper_case_acronyms)]
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2022 Heath Stewart.
// Copyright 2024 Heath Stewart.
// Licensed under the MIT License. See LICENSE.txt in the project root for license information.

#![allow(dead_code)]
Expand Down
2 changes: 1 addition & 1 deletion src/record.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2022 Heath Stewart.
// Copyright 2024 Heath Stewart.
// Licensed under the MIT License. See LICENSE.txt in the project root for license information.

use crate::ffi;
Expand Down
6 changes: 3 additions & 3 deletions src/session.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2022 Heath Stewart.
// Copyright 2024 Heath Stewart.
// Licensed under the MIT License. See LICENSE.txt in the project root for license information.

use crate::ffi;
Expand Down Expand Up @@ -41,7 +41,7 @@ impl Session {
/// If `None` the default action is run e.g., `INSTALL`.
///
/// To schedule a deferred custom action with its `CustomActionData`,
/// call `do_deferred_action`.
/// call [`Session::do_deferred_action()`].
pub fn do_action(&self, action: Option<&str>) -> Result<()> {
unsafe {
let action = match action {
Expand Down Expand Up @@ -195,7 +195,7 @@ pub enum MessageType {
CommonData = 0x0b00_0000,
}

/// Run modes passed to `Session::mode`.
/// Run modes passed to [`Session::mode()`].
#[repr(u32)]
pub enum RunMode {
/// Administrative mode install, else product install.
Expand Down
26 changes: 14 additions & 12 deletions src/view.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2022 Heath Stewart.
// Copyright 2024 Heath Stewart.
// Licensed under the MIT License. See LICENSE.txt in the project root for license information.

use crate::ffi;
Expand All @@ -8,20 +8,20 @@ use crate::{Error, Record, Result};
use crate::Database;

/// The `View` object represents a result set obtained when processing a query
/// using the `OpenView` method of the [`Database`] object. Before any data can be transferred,
/// the query must be executed using the `execute` method, passing to it all replaceable parameters
/// using the [`Database::open_view()`] method. Before any data can be transferred,
/// the query must be executed using the [`View::execute()`] method, passing to it all replaceable parameters
/// designated within the SQL query string.
///
/// The query may be executed again, with different parameters if needed,
/// but only after freeing the result set either by fetching all the records or by calling the `close` method.
/// but only after freeing the result set either by fetching all the records or by calling the [`View::close()`] method.
pub struct View {
h: ffi::PMSIHANDLE,
}

impl View {
/// Releases the result set for an executed view.
///
/// `close` must be called before `execute` can be called again unless all records have been fetched.
/// `close` must be called before [`View::execute()`] can be called again unless all records have been fetched.
pub fn close(&self) {
unsafe {
ffi::MsiViewClose(*self.h);
Expand All @@ -33,7 +33,7 @@ impl View {
///
/// The values of these parameters are passed in as the corresponding fields of a parameter record.
///
/// `close` must be called before `execute` can be called again unless all records have been fetched.
/// [`View::close()`] must be called before `execute` can be called again unless all records have been fetched.
pub fn execute(&self, record: Option<Record>) -> Result<()> {
unsafe {
let h = match record {
Expand All @@ -54,7 +54,9 @@ impl View {

/// Updates a fetched record.
///
/// You can pass `Update` or `Delete` with a record immediately after using `Insert`, `InsertTemporary`, or `Seek` provided you have *not* modified the 0th field of the inserted or sought record.
/// You can pass [`Update`](ModifyMode::Update) or [`Delete`](ModifyMode::Delete) with a record immediately after using
/// [`Insert`](ModifyMode::Insert), [`InsertTemporary`](ModifyMode::InsertTemporary), or [`Seek`](ModifyMode::Seek)
/// provided you have *not* modified the 0th field of the inserted or sought record.
///
/// You cannot fetch a record that contains binary data from one database and then use that record to insert the data into another database.
///
Expand Down Expand Up @@ -101,31 +103,31 @@ impl Iterator for View {
}
}

/// Modify modes passed to `View::modify`.
/// Modify modes passed to [`View::modify()`].
#[repr(u32)]
pub enum ModifyMode {
/// Refreshes the information in the supplied record without changing the position in the result set and without affecting subsequent fetch operations.
/// The record may then be used for subsequent Update, Delete, and Refresh. All primary key columns of the table must be in the query and the record must have at least as many fields as the query.
/// Seek cannot be used with multi-table queries. This mode cannot be used with a view containing joins.
Seek = u32::MAX,

/// Refreshes the information in the record. Must first call `fetch` on [`View`] with the same record.
/// Refreshes the information in the record. Must first call [`View::next()`] with the same record.
/// Fails for a deleted row. Works with read-write and read-only records.
Refresh = 0,

/// Inserts a record. Fails if a row with the same primary keys exists. Fails with a read-only database.
/// This mode cannot be used with a view containing joins.
Insert = 1,

/// Updates an existing record. Non-primary keys only. Must first call `fetch` on [`View`].
/// Updates an existing record. Non-primary keys only. Must first call [`View::next()`].
/// Fails with a deleted record. Works only with read-write records.
Update = 2,

/// Writes current data in the cursor to a table row. Updates record if the primary keys match an existing row and inserts if they do not match.
/// Fails with a read-only database. This mode cannot be used with a view containing joins.
Assign = 3,

/// Updates or deletes and inserts a record into a table. Must first call `fetch` on [`View`] with the same record.
/// Updates or deletes and inserts a record into a table. Must first call [`View::next()`] with the same record.
/// Updates record if the primary keys are unchanged. Deletes old row and inserts new if primary keys have changed. Fails with a read-only database.
/// This mode cannot be used with a view containing joins.
Replace = 4,
Expand All @@ -135,7 +137,7 @@ pub enum ModifyMode {
/// This mode cannot be used with a view containing joins.
Merge = 5,

/// Remove a row from the table. You must first call the `fetch` on [`View`] function with the same record.
/// Remove a row from the table. You must first call the [`View::next()`] function with the same record.
/// Fails if the row has been deleted. Works only with read-write records. This mode cannot be used with a view containing joins.
Delete = 6,

Expand Down

0 comments on commit cd7a2de

Please sign in to comment.