Hi all !
I'm new to this forum (and also to LLBLGEN), and I first want to thank you all for this wonderful product that will tremendously help us during the development of our project...
First post among many more to come I guess.
I'm currently playing with the demo version 2.6, the runtime version of the ORM Support Class is 2.6.8.1114
My project is built on .NET 2.0.
My test project uses Postgres 8.3.
I have a very simple table (Slony users will certainly recognize it):
CREATE TABLE _biocluster.sl_table
(
tab_id integer NOT NULL, -- Unique key for Slony-I to use to identify the table
tab_reloid oid NOT NULL, -- The OID of the table in pg_catalog.pg_class.oid
tab_relname "name" NOT NULL, -- The name of the table in pg_catalog.pg_class.relname used to recover from a dump/restore cycle
tab_nspname "name" NOT NULL, -- The name of the schema in pg_catalog.pg_namespace.nspname used to recover from a dump/restore cycle
tab_set integer, -- ID of the replication set the table is in
tab_idxname "name" NOT NULL, -- The name of the primary index of the table
tab_altered boolean NOT NULL, -- Has the table been modified for replication?
tab_comment text, -- Human-oriented description of the table
CONSTRAINT "sl_table-pkey" PRIMARY KEY (tab_id),
CONSTRAINT "tab_set-set_id-ref" FOREIGN KEY (tab_set)
REFERENCES _biocluster.sl_set (set_id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION,
CONSTRAINT sl_table_tab_reloid_key UNIQUE (tab_reloid)
)
WITH (OIDS=FALSE);
All "name" typed fields are correctly mapped into string attibutes by llglgen.
then here is my piece of code, the goal is to retrieve all distinct tab_nspname values that are not prefixed by "sys" :
private void formTest_Load (object sender, EventArg e)
{
ResultsetFields schemaListFields = new ResultsetFields(1);
schemaListFields.DefineField (SlTableFields.TabNspname, 0);
IRelationPredicateBucket bucket = new RelationPredicateBucket();
// My "WHERE tab_nspname NOT LIKE 'sys%' " statement
bucket.PredicateExpression.Add ( !(SlTableFields.TabNspname % "sys%) );
DataTable schemaList = new DataTable();
SortExpression sorter = new SortExpression (SlTableFields.TabNspname | SortOperator.Ascending);
using (DataAccessAdapter adapter = new DataAccessAdapter() )
{
adapter.SchemaNameUsageSetting = SchemaNameUsage.ForceName;
adapter.SchemaNameToUse = "_biocluster";
adapter.FetchTypedList (schemaListFields, schemaList, bucket, 0, sorter, false);
}
}
When run, I got a ORMQueryExecutionException :
_An exception was caught during the execution of a retrieval query: ERROR: 22007: invalid input syntax for type timestamp: "%sys%". Check InnerException, QueryExecuted and Parameters of this exception to examine the cause of this exception.
_
Fact is, the error is genrated by Postgres server, because the generated query is incorrect, here it is:
SELECT DISTINCT "_biocluster"."sl_table"."tab_nspname" AS "TabNspname" FROM "_biocluster"."sl_table" WHERE ( ( NOT "_biocluster"."sl_table"."tab_nspname" LIKE '%sys%'::timestamp)) ORDER BY "_biocluster"."sl_table"."tab_nspname" ASC
The "LIKE '%sys%'::timestamp " is wrong, I don't know where this timestamp comes from...
Even if I change the type of tab_nspname column from "name" to character varying(255) I end up with the same result...
I tried to google that but could not find any answer...
Thanks so much in advance for your help...
Michael
FYI, here is the stack trace:
at SD.LLBLGen.Pro.ORMSupportClasses.RetrievalQuery.Execute(CommandBehavior behavior)
at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase .ExecuteMultiRowDataTableRetrievalQuery(IRetrievalQuery queryToExecute, DbDataAdapter dataAdapterToUse, DataTable tableToFill, IFieldPersistenceInfo[] fieldsPersistenceInfo)
at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase.FetchTypedList(IEntityFields2 fieldCollectionToFetch, DataTable dataTableToFill, IRelationPredicateBucket filterBucket, Int32 maxNumberOfItemsToReturn, ISortExpression sortClauses, Boolean allowDuplicates, IGroupByCollection groupByClause, Int32 pageNumber, Int32 pageSize)
at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase.FetchTypedList(IEntityFields2 fieldCollectionToFetch, DataTable dataTableToFill, IRelationPredicateBucket filterBucket, Int32 maxNumberOfItemsToReturn, ISortExpression sortClauses, Boolean allowDuplicates)
at UT.Core.Database.frmImageInsert.frmImageInsert_Load(Object sender, EventArgs e) in Y:\UT\Core\Database\frmImageInsert.cs:line 69
at System.Windows.Forms.Form.OnLoad(EventArgs e)
at System.Windows.Forms.Form.OnCreateControl()
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl()
at System.Windows.Forms.Control.WmShowWindow(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.ContainerControl.WndProc(Message& m)
at System.Windows.Forms.Form.WmShowWindow(Message& m)
at System.Windows.Forms.Form.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.IntCreateWindowEx(Int32 dwExStyle, String lpszClassName, String lpszWindowName, Int32 style, Int32 x, Int32 y, Int32 width, Int32 height, HandleRef hWndParent, HandleRef hMenu, HandleRef hInst, Object pvParam)
at System.Windows.Forms.UnsafeNativeMethods.CreateWindowEx(Int32 dwExStyle, String lpszClassName, String lpszWindowName, Int32 style, Int32 x, Int32 y, Int32 width, Int32 height, HandleRef hWndParent, HandleRef hMenu, HandleRef hInst, Object pvParam)
at System.Windows.Forms.NativeWindow.CreateHandle(CreateParams cp)
at System.Windows.Forms.Control.CreateHandle()
at System.Windows.Forms.Form.CreateHandle()
at System.Windows.Forms.Control.get_Handle()
at System.Windows.Forms.Form.SetVisibleCore(Boolean value)
at System.Windows.Forms.Control.Show()
at UT.Core.Database.frmMain.LaunchChildForm(Form ChildForm) in Y:\UT\Core\Database\frmMain.cs:line 40
at UT.Core.Database.frmMain.insertImagesToolStripMenuItem_Click(Object sender, EventArgs e) in Y:\UT\Core\Database\frmMain.cs:line 62
at System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e)
at System.Windows.Forms.ToolStripMenuItem.OnClick(EventArgs e)
at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
at System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
at System.Windows.Forms.ToolStripItem.FireEventInteractive(EventArgs e, ToolStripItemEventType met)
at System.Windows.Forms.ToolStripItem.FireEvent(EventArgs e, ToolStripItemEventType met)
at System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
at System.Windows.Forms.ToolStripDropDown.OnMouseUp(MouseEventArgs mea)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.ToolStrip.WndProc(Message& m)
at System.Windows.Forms.ToolStripDropDown.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms. UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at UT.Core.Database.Program.Main() in Y:\UT\Core\Database\Program.cs:line 17