I also noticed that I had to use exact case for the database name. I have a db ‘Main’, but specifying ‘main’ in the connection will result in an error no such database.
For some reason I must have thought it was fun to surround table or column names with single quotes in some cases. Now there is now way to even search for that. Yeah… try to search for ’ when that is the default comment character!
make a method to lowercase all the names in the postgres database.
if you have foreign keys, you must run it 2 times . you will get an error at the first run.
For me it doesn’t. It doesn’t allow returning any fields not used in an aggregate (sum, avg, count, etc.) I guess SQLite returns the first value in this case.
06:18:32 Kernel error: ERROR: column “orders.id” must appear in the GROUP BY clause or be used in an aggregate function.
My conversion program removed all quotes and back ticks from schema. This resulted in all lowercase identifiers. Fortunately as Kem mentioned, I didn’t hate my life enough to use identifiers with spaces. I switched to all CamelCase a while back because of a severe hatred that I have for under_scores.
That was one of the next things I wanted to try out. I have a status field in my orders table that I use to tell my server to import or modify the order in QuickBooks. I would like to replace that with a trigger and a notification.
I know I can set up a notification to occur it the table changes but I haven’t checked to see if I can trigger when a field becomes a certain value. Although querying every time the table changes would be better than my current method of querying at every timer interval.
[quote=305682:@Neil Burkholder]Yeah. It would have been nice to have something like this to read before I started.
Instead of this (no offence)[/quote]
Hi Man, It’s Christmas and the one thing I learned from the Swiss is that you don’t on Christmas!
My base class for modelling data access is called: TModelBase (I’m an old TPW programmer what can I say…) Anyways it has a method called GetTableName:
Dim tableName As String = OnGetTableName
If tableName.Trim.Len = 0 Then
Dim ti As Introspection.TypeInfo = Introspection.GetType( Self )
Dim rex As New RegEx
rex.SearchPattern = "([a-z])([A-Z])"
rex.ReplacementPattern = "$1_$2"
rex.Options.CaseSensitive = true
rex.Options.ReplaceAllMatches = true
tableName = rex.Replace( ti.Name ).Lowercase
If tableName.BeginsWith( "t" ) Then
tableName = tableName.ChopLeft( 1 )
End If
End If
Return tableName.Lowercase
Which raises an event to allow you to provide any table name you want. Otherwise it converts your camelCase TModelBase into model_base for use with PostgreSQL.
Now all we need is someone cooler than me to optimise it and then we can steel it back