Added function to MySqlSession to check if a row exists. Bumped package version to 1.1.4
This commit is contained in:
		@@ -7,7 +7,7 @@
 | 
				
			|||||||
    <AssemblyName>MontoyaTech.MySqlPlus</AssemblyName>
 | 
					    <AssemblyName>MontoyaTech.MySqlPlus</AssemblyName>
 | 
				
			||||||
    <RootNamespace>MontoyaTech.MySqlPlus</RootNamespace>
 | 
					    <RootNamespace>MontoyaTech.MySqlPlus</RootNamespace>
 | 
				
			||||||
    <Title>MontoyaTech.MySqlPlus</Title>
 | 
					    <Title>MontoyaTech.MySqlPlus</Title>
 | 
				
			||||||
    <Version>1.1.3</Version>
 | 
					    <Version>1.1.4</Version>
 | 
				
			||||||
    <Company>MontoyaTech</Company>
 | 
					    <Company>MontoyaTech</Company>
 | 
				
			||||||
    <Description>A simple C# library to help work with MySql.</Description>
 | 
					    <Description>A simple C# library to help work with MySql.</Description>
 | 
				
			||||||
    <Copyright>MontoyaTech 2023</Copyright>
 | 
					    <Copyright>MontoyaTech 2023</Copyright>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -145,6 +145,42 @@ namespace MontoyaTech.MySqlPlus
 | 
				
			|||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        /// <summary>
 | 
				
			||||||
 | 
					        /// Returns whether or not a row of a given type exists by id in the db.
 | 
				
			||||||
 | 
					        /// </summary>
 | 
				
			||||||
 | 
					        /// <typeparam name="T"></typeparam>
 | 
				
			||||||
 | 
					        /// <param name="id"></param>
 | 
				
			||||||
 | 
					        /// <returns></returns>
 | 
				
			||||||
 | 
					        public bool Exists<T>(ulong id)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            using (var command = new MySqlCommand())
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                command.Exists<T>(id);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                using (var reader = this.Connection.ExecuteReader(command))
 | 
				
			||||||
 | 
					                    return reader.GetBoolean(0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        /// <summary>
 | 
				
			||||||
 | 
					        /// Returns whether or not a row of a given type exists by id in the db.
 | 
				
			||||||
 | 
					        /// </summary>
 | 
				
			||||||
 | 
					        /// <typeparam name="T"></typeparam>
 | 
				
			||||||
 | 
					        /// <param name="id"></param>
 | 
				
			||||||
 | 
					        /// <returns></returns>
 | 
				
			||||||
 | 
					        public bool Exists<T>(string id)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            using (var command = new MySqlCommand())
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                command.Exists<T>(id);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                using (var reader = this.Connection.ExecuteReader(command))
 | 
				
			||||||
 | 
					                    return reader.GetBoolean(0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        /// <summary>
 | 
					        /// <summary>
 | 
				
			||||||
        /// Deletes a row in the db.
 | 
					        /// Deletes a row in the db.
 | 
				
			||||||
        /// </summary>
 | 
					        /// </summary>
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user