database query : add with(nolock)

This commit is contained in:
chi
2024-01-30 10:05:52 +09:00
parent ed37fd6c40
commit 3c86087f76
53 changed files with 6656 additions and 6423 deletions

View File

@@ -9,15 +9,15 @@
<Tables>
<TableAdapter BaseClass="System.ComponentModel.Component" DataAccessorModifier="AutoLayout, AnsiClass, Class, Public" DataAccessorName="PersonInvStockTableAdapter" GeneratorDataComponentClassName="PersonInvStockTableAdapter" Name="PersonInvStock" UserDataComponentName="PersonInvStockTableAdapter">
<MainSource>
<DbSource ConnectionRef="gwcs (Settings)" DbObjectName="GroupWare.dbo.Inventory" DbObjectType="Table" FillMethodModifier="Public" FillMethodName="Fill" GenerateMethods="Both" GenerateShortCommands="false" GeneratorGetMethodName="GetData" GeneratorSourceName="Fill" GetMethodModifier="Public" GetMethodName="GetData" QueryType="Rowset" ScalarCallRetval="System.Object, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="true" UserGetMethodName="GetData" UserSourceName="Fill">
<DbSource ConnectionRef="gwcs (Settings)" DbObjectName="EE.dbo.Inventory" DbObjectType="Table" FillMethodModifier="Public" FillMethodName="Fill" GenerateMethods="Both" GenerateShortCommands="false" GeneratorGetMethodName="GetData" GeneratorSourceName="Fill" GetMethodModifier="Public" GetMethodName="GetData" QueryType="Rowset" ScalarCallRetval="System.Object, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="true" UserGetMethodName="GetData" UserSourceName="Fill">
<SelectCommand>
<DbCommand CommandType="Text" ModifiedByUser="false">
<CommandText>SELECT dbo.getUserName(uid) AS username, ISNULL(dbo.getProjectName(project), '--') AS project, MAX(pdate) AS pdate, ItemName, SUM(dr_qty) AS stock
FROM Inventory
<CommandText>SELECT dbo.getUserName(uid) AS username, ISNULL(dbo.getProjectName(project), '--') AS project, MAX(pdate) AS pdate, item, SUM(dr_qty) AS stock
FROM Inventory WITH (nolock)
WHERE (dbo.getUserName(uid) LIKE @uid)
GROUP BY dbo.getUserName(uid), dbo.getProjectName(project), ItemName
GROUP BY dbo.getUserName(uid), dbo.getProjectName(project), item
HAVING (SUM(dr_qty) &lt;&gt; 0)
ORDER BY username, project, ItemName</CommandText>
ORDER BY username, project, item</CommandText>
<Parameters>
<Parameter AllowDbNull="false" AutogeneratedName="uid" ColumnName="" DataSourceName="" DataTypeServer="unknown" DbType="AnsiString" Direction="Input" ParameterName="@uid" Precision="0" Scale="0" Size="1024" SourceColumn="" SourceColumnNullMapping="false" SourceVersion="Current" />
</Parameters>
@@ -29,24 +29,24 @@ ORDER BY username, project, ItemName</CommandText>
<Mapping SourceColumn="username" DataSetColumn="username" />
<Mapping SourceColumn="project" DataSetColumn="project" />
<Mapping SourceColumn="pdate" DataSetColumn="pdate" />
<Mapping SourceColumn="ItemName" DataSetColumn="ItemName" />
<Mapping SourceColumn="stock" DataSetColumn="stock" />
<Mapping SourceColumn="item" DataSetColumn="item" />
</Mappings>
<Sources />
</TableAdapter>
<TableAdapter BaseClass="System.ComponentModel.Component" DataAccessorModifier="AutoLayout, AnsiClass, Class, Public" DataAccessorName="jagosummaryTableAdapter" GeneratorDataComponentClassName="jagosummaryTableAdapter" Name="jagosummary" UserDataComponentName="jagosummaryTableAdapter">
<MainSource>
<DbSource ConnectionRef="gwcs (Settings)" DbObjectName="GroupWare.dbo.Items" DbObjectType="Table" FillMethodModifier="Public" FillMethodName="Fill" GenerateMethods="Both" GenerateShortCommands="false" GeneratorGetMethodName="GetData" GeneratorSourceName="Fill" GetMethodModifier="Public" GetMethodName="GetData" QueryType="Rowset" ScalarCallRetval="System.Object, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="true" UserGetMethodName="GetData" UserSourceName="Fill">
<DbSource ConnectionRef="gwcs (Settings)" DbObjectName="EE.dbo.Items" DbObjectType="Table" FillMethodModifier="Public" FillMethodName="Fill" GenerateMethods="Both" GenerateShortCommands="false" GeneratorGetMethodName="GetData" GeneratorSourceName="Fill" GetMethodModifier="Public" GetMethodName="GetData" QueryType="Rowset" ScalarCallRetval="System.Object, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="true" UserGetMethodName="GetData" UserSourceName="Fill">
<SelectCommand>
<DbCommand CommandType="Text" ModifiedByUser="true">
<DbCommand CommandType="Text" ModifiedByUser="false">
<CommandText>SELECT Items.idx, MAX(Inventory.pdate) AS lastDate, Items.name, Items.sid, Items.model, SUM(Inventory.dr_qty) AS Qty, SUM(Inventory.dr_amt) AS Amt, Items.supply
FROM Inventory LEFT OUTER JOIN
Items ON Inventory.gcode = Items.gcode AND Inventory.item = Items.idx
FROM Inventory WITH (nolock) LEFT OUTER JOIN
Items WITH (nolock) ON Inventory.gcode = Items.gcode AND Inventory.item = Items.idx
WHERE (Inventory.gcode = @gcode) AND (Inventory.pdate &lt;= @baseDate)
GROUP BY Items.idx, Items.name, Items.sid, Items.model, Items.supply</CommandText>
<Parameters>
<Parameter AllowDbNull="false" AutogeneratedName="gcode" ColumnName="gcode" DataSourceName="GroupWare.dbo.Inventory" DataTypeServer="varchar(10)" DbType="AnsiString" Direction="Input" ParameterName="@gcode" Precision="0" ProviderType="VarChar" Scale="0" Size="10" SourceColumn="gcode" SourceColumnNullMapping="false" SourceVersion="Current" />
<Parameter AllowDbNull="true" AutogeneratedName="baseDate" ColumnName="pdate" DataSourceName="GroupWare.dbo.Inventory" DataTypeServer="varchar(10)" DbType="AnsiString" Direction="Input" ParameterName="@baseDate" Precision="0" ProviderType="VarChar" Scale="0" Size="10" SourceColumn="pdate" SourceColumnNullMapping="false" SourceVersion="Current" />
<Parameter AllowDbNull="false" AutogeneratedName="gcode" ColumnName="gcode" DataSourceName="EE.dbo.Inventory" DataTypeServer="varchar(10)" DbType="AnsiString" Direction="Input" ParameterName="@gcode" Precision="0" ProviderType="VarChar" Scale="0" Size="10" SourceColumn="gcode" SourceColumnNullMapping="false" SourceVersion="Current" />
<Parameter AllowDbNull="true" AutogeneratedName="baseDate" ColumnName="pdate" DataSourceName="EE.dbo.Inventory" DataTypeServer="varchar(10)" DbType="AnsiString" Direction="Input" ParameterName="@baseDate" Precision="0" ProviderType="VarChar" Scale="0" Size="10" SourceColumn="pdate" SourceColumnNullMapping="false" SourceVersion="Current" />
</Parameters>
</DbCommand>
</SelectCommand>
@@ -71,8 +71,8 @@ GROUP BY Items.idx, Items.name, Items.sid, Items.model, Items.supply</CommandTex
<DbCommand CommandType="Text" ModifiedByUser="false">
<CommandText>SELECT Inventory.place, MAX(Inventory.pdate) AS lastDate, Items.name, Items.sid, Items.model, SUM(Inventory.dr_qty) AS Qty, SUM(Inventory.dr_amt) AS Amt, Items.supply, Inventory.item,
Inventory.box
FROM Inventory LEFT OUTER JOIN
Items ON Inventory.gcode = Items.gcode AND Inventory.item = Items.idx
FROM Inventory WITH (nolock) LEFT OUTER JOIN
Items WITH (nolock) ON Inventory.gcode = Items.gcode AND Inventory.item = Items.idx
WHERE (Inventory.gcode = @gcode) AND (Inventory.pdate &lt;= @baseDate) AND (ISNULL(Inventory.place, N'') LIKE @place)
GROUP BY Items.name, Items.sid, Items.model, Items.supply, Inventory.place, Inventory.item, Inventory.box</CommandText>
<Parameters>
@@ -102,8 +102,8 @@ GROUP BY Items.name, Items.sid, Items.model, Items.supply, Inventory.place, Inve
<DbCommand CommandType="Text" ModifiedByUser="true">
<CommandText>SELECT Inventory.place, MAX(Inventory.pdate) AS lastDate, Items.name, Items.sid, Items.model, SUM(Inventory.dr_qty) AS Qty, SUM(Inventory.dr_amt) AS Amt, Items.supply, Inventory.item,
Inventory.box
FROM Inventory LEFT OUTER JOIN
Items ON Inventory.gcode = Items.gcode AND Inventory.item = Items.idx
FROM Inventory WITH (nolock) LEFT OUTER JOIN
Items WITH (nolock) ON Inventory.gcode = Items.gcode AND Inventory.item = Items.idx
WHERE (Inventory.gcode = @gcode) AND (Inventory.pdate &lt;= @baseDate) AND (Items.idx = @item)
GROUP BY Items.name, Items.sid, Items.model, Items.supply, Inventory.place, Inventory.item, Inventory.box</CommandText>
<Parameters>
@@ -124,7 +124,7 @@ GROUP BY Items.name, Items.sid, Items.model, Items.supply, Inventory.place, Inve
<xs:element name="DSReport" msdata:IsDataSet="true" msdata:UseCurrentLocale="true" msprop:Generator_UserDSName="DSReport" msprop:EnableTableAdapterManager="true" msprop:Generator_DataSetName="DSReport">
<xs:complexType>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="PersonInvStock" msprop:Generator_RowClassName="PersonInvStockRow" msprop:Generator_RowEvHandlerName="PersonInvStockRowChangeEventHandler" msprop:Generator_RowDeletedName="PersonInvStockRowDeleted" msprop:Generator_RowDeletingName="PersonInvStockRowDeleting" msprop:Generator_RowEvArgName="PersonInvStockRowChangeEvent" msprop:Generator_TablePropName="PersonInvStock" msprop:Generator_RowChangedName="PersonInvStockRowChanged" msprop:Generator_UserTableName="PersonInvStock" msprop:Generator_RowChangingName="PersonInvStockRowChanging" msprop:Generator_TableClassName="PersonInvStockDataTable" msprop:Generator_TableVarName="tablePersonInvStock">
<xs:element name="PersonInvStock" msprop:Generator_RowEvHandlerName="PersonInvStockRowChangeEventHandler" msprop:Generator_RowDeletedName="PersonInvStockRowDeleted" msprop:Generator_RowDeletingName="PersonInvStockRowDeleting" msprop:Generator_RowEvArgName="PersonInvStockRowChangeEvent" msprop:Generator_TablePropName="PersonInvStock" msprop:Generator_RowChangedName="PersonInvStockRowChanged" msprop:Generator_UserTableName="PersonInvStock" msprop:Generator_RowChangingName="PersonInvStockRowChanging" msprop:Generator_RowClassName="PersonInvStockRow" msprop:Generator_TableClassName="PersonInvStockDataTable" msprop:Generator_TableVarName="tablePersonInvStock">
<xs:complexType>
<xs:sequence>
<xs:element name="username" msdata:ReadOnly="true" msprop:Generator_ColumnPropNameInTable="usernameColumn" msprop:nullValue="_empty" msprop:Generator_ColumnPropNameInRow="username" msprop:Generator_UserColumnName="username" msprop:Generator_ColumnVarNameInTable="columnusername" minOccurs="0">
@@ -148,21 +148,15 @@ GROUP BY Items.name, Items.sid, Items.model, Items.supply, Inventory.place, Inve
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="ItemName" msprop:Generator_ColumnPropNameInTable="ItemNameColumn" msprop:nullValue="_empty" msprop:Generator_ColumnPropNameInRow="ItemName" msprop:Generator_UserColumnName="ItemName" msprop:Generator_ColumnVarNameInTable="columnItemName" minOccurs="0">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="200" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="stock" msdata:ReadOnly="true" msprop:Generator_ColumnPropNameInTable="stockColumn" msprop:nullValue="0" msprop:Generator_ColumnPropNameInRow="stock" msprop:Generator_UserColumnName="stock" msprop:Generator_ColumnVarNameInTable="columnstock" type="xs:int" minOccurs="0" />
<xs:element name="item" msprop:Generator_UserColumnName="item" msprop:Generator_ColumnPropNameInTable="itemColumn" msprop:Generator_ColumnPropNameInRow="item" msprop:Generator_ColumnVarNameInTable="columnitem" type="xs:int" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="jagosummary" msprop:Generator_RowEvHandlerName="jagosummaryRowChangeEventHandler" msprop:Generator_RowDeletedName="jagosummaryRowDeleted" msprop:Generator_RowDeletingName="jagosummaryRowDeleting" msprop:Generator_RowEvArgName="jagosummaryRowChangeEvent" msprop:Generator_TablePropName="jagosummary" msprop:Generator_RowChangedName="jagosummaryRowChanged" msprop:Generator_UserTableName="jagosummary" msprop:Generator_RowChangingName="jagosummaryRowChanging" msprop:Generator_RowClassName="jagosummaryRow" msprop:Generator_TableClassName="jagosummaryDataTable" msprop:Generator_TableVarName="tablejagosummary">
<xs:complexType>
<xs:sequence>
<xs:element name="idx" msdata:ReadOnly="true" msdata:AutoIncrement="true" msdata:AutoIncrementSeed="-1" msdata:AutoIncrementStep="-1" msprop:Generator_UserColumnName="idx" msprop:Generator_ColumnPropNameInTable="idxColumn" msprop:Generator_ColumnPropNameInRow="idx" msprop:Generator_ColumnVarNameInTable="columnidx" type="xs:int" minOccurs="0" />
<xs:element name="idx" msdata:ReadOnly="true" msdata:AutoIncrement="true" msdata:AutoIncrementSeed="-1" msdata:AutoIncrementStep="-1" msprop:Generator_ColumnPropNameInTable="idxColumn" msprop:Generator_ColumnPropNameInRow="idx" msprop:Generator_UserColumnName="idx" msprop:Generator_ColumnVarNameInTable="columnidx" type="xs:int" minOccurs="0" />
<xs:element name="lastDate" msdata:ReadOnly="true" msprop:Generator_ColumnPropNameInTable="lastDateColumn" msprop:nullValue="_empty" msprop:Generator_ColumnPropNameInRow="lastDate" msprop:Generator_UserColumnName="lastDate" msprop:Generator_ColumnVarNameInTable="columnlastDate" minOccurs="0">
<xs:simpleType>
<xs:restriction base="xs:string">
@@ -258,7 +252,7 @@ GROUP BY Items.name, Items.sid, Items.model, Items.supply, Inventory.place, Inve
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="placebox" msdata:ReadOnly="true" msdata:Expression="place + '_' + box" msprop:Generator_ColumnPropNameInRow="placebox" msprop:Generator_ColumnPropNameInTable="placeboxColumn" msprop:Generator_ColumnVarNameInTable="columnplacebox" msprop:Generator_UserColumnName="placebox" type="xs:string" minOccurs="0" />
<xs:element name="placebox" msdata:ReadOnly="true" msdata:Expression="place + '_' + box" msprop:Generator_ColumnPropNameInTable="placeboxColumn" msprop:Generator_ColumnPropNameInRow="placebox" msprop:Generator_UserColumnName="placebox" msprop:Generator_ColumnVarNameInTable="columnplacebox" type="xs:string" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>