I have requirement need script. I did it and i share it, hope it’ll useful for someone.
SELECT
t.tablename,
a.attname AS “Column”
–,pg_catalog.format_type (a.atttypid, a.atttypmod) AS “Datatype”
FROM
pg_tables t,
pg_catalog.pg_attribute a
WHERE
a.attnum > 0
AND NOT a.attisdropped
AND a.attrelid = (
SELECT
c.oid
FROM
pg_catalog.pg_class c
LEFT JOIN pg_catalog.pg_namespace n
ON n.oid = c.relnamespace
WHERE
c.relname = t.tablename
AND pg_catalog.pg_table_is_visible (c.oid)
)
AND t.tablename NOT LIKE ‘pg%’
AND t.tablename NOT LIKE ’sql%’
Archive for April, 2009
8 Apr
PostgreSQL Tips: Get tablenames and column in database
3 Apr
NHibernate Tips: Updating objects
1. Updating in the same ISession
Transactional persistent instances (ie. objects loaded, saved, created or queried by the ISession) may be manipulated by the application [...]
3 Apr
NHibernate Tips: Criteria queries & Queries in native SQL
Criteria queries
HQL is extremely powerful but some people prefer to build queries dynamically, using an object oriented API, rather than embedding strings in their .NET code. For these people, NHibernate provides an intuitive ICriteria query API.
ICriteria crit = session.CreateCriteria(typeof(Cat));
crit.Add( Expression.Eq(“color”, Eg.Color.Black) );
crit.SetMaxResults(10);
IList cats = crit.List();
If you are uncomfortable with SQL-like syntax, this is perhaps the [...]
3 Apr
NHibernate Tips: The IQuery interface
If you need to specify bounds upon your result set (the maximum number of rows you want to retrieve and / or the first row you want to retrieve) you should obtain an instance of NHibernate.IQuery:
IQuery q = sess.CreateQuery(“from DomesticCat cat”);
q.SetFirstResult(20);
q.SetMaxResults(10);
IList cats = q.List();
You may even define a named query in the mapping document. (Remember [...]
3 Apr
NHibernate Tips : Querying
If you don’t know the identifier(s) of the object(s) you are looking for, use the Find() methods of ISession. NHibernate supports a simple but powerful object oriented query language.
IList cats = sess.Find(
“from Cat as cat where cat.Birthdate [...]
3 Apr
C# Tutorial: Get,Set properties for object.
I lazy when do one work every coding, that’s copy DAO to Entity in Hibernate (my company’s framework) please dont ask why do that ^^.
Here is may code:
static void Main(string[] args)
{
User dto = new User();
//dto.ID = new Guid();
dto.FirstName = “Bao”;
dto.MiddleName = “Duc Phuc”;
dto.LastName = “Nguyen”;
UserBE be = new UserBE();
be = ConvertDTOtoBE<User, UserBE>(dto, be) as UserBE;
PropertyInfo[] [...]
2 Apr
C# Tutorial – Using Reflection to Get Object Information
public class MyObject
{
//public fields
public string myStringField;
public int myIntField;
public MyObject myObjectField;
//public properties
public string MyStringProperty { get; set; }
public int MyIntProperty { get; set; }
public MyObject MyObjectProperty { get; set; }
//public events
public event EventHandler MyEvent1;
public event EventHandler MyEvent2;
}
To get a list of public fields in an object, we’ll use Type’s GetField method:
Type myObjectType = typeof(MyObject);
System.Reflection.FieldInfo[] fieldInfo = [...]
Recent Comments