Re: [fpc-pascal] SQL show tables
Op maandag 12-01-2009 om 13:30 uur [tijdzone -0500], schreef David B Copeland: > "Query: Cannot open a non-select statement" 'show tables' is not a valid sql-statement. It is a MySQL-hack. The TODBCConnection can not see that it is connected to a MySQL server and thus doesn't recognise this statement as a select-statement. If you use a TMySQLConnection it will work. You can fill in a bug report to ask if TODBCConnection can recognise 'show' as 'select'. We'll have to look what kind of effect that has on other (really sql-based) database-servers. btw: To get the list of tables, you can better use TSQLConnection.GetTableNames. Joost. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] SQL show tables
Joost van der Sluis wrote: Op maandag 12-01-2009 om 13:30 uur [tijdzone -0500], schreef David B Copeland: "Query: Cannot open a non-select statement" 'show tables' is not a valid sql-statement. It is a MySQL-hack. The TODBCConnection can not see that it is connected to a MySQL server and thus doesn't recognise this statement as a select-statement. If you use a TMySQLConnection it will work. You can fill in a bug report to ask if TODBCConnection can recognise 'show' as 'select'. We'll have to look what kind of effect that has on other (really sql-based) database-servers. If you (the original poster) uses Mysql 5 or up, then "Show tables" is not needed. Use the information-schema instead SELECT table_name FROM INFORMATION_SCHEMA.TABLES WHERE table_schema = '/|db_name|/' ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] SQL show tables
On Tue, 2009-01-13 at 10:37 +, Martin Friebe wrote: > Joost van der Sluis wrote: > > Op maandag 12-01-2009 om 13:30 uur [tijdzone -0500], schreef David B > > Copeland: > > > > > >> "Query: Cannot open a non-select statement" > >> > > > > 'show tables' is not a valid sql-statement. It is a MySQL-hack. The > > TODBCConnection can not see that it is connected to a MySQL server and > > thus doesn't recognise this statement as a select-statement. If you use > > a TMySQLConnection it will work. You can fill in a bug report to ask if > > TODBCConnection can recognise 'show' as 'select'. We'll have to look > > what kind of effect that has on other (really sql-based) > > database-servers. > > > If you (the original poster) uses Mysql 5 or up, then "Show tables" is > not needed. Use the information-schema instead > > SELECT table_name FROM INFORMATION_SCHEMA.TABLES WHERE table_schema = > '/|db_name|/' > Thanks for all the info. I did try 'show tables' with a TMySQLConnection and found that it worked. But I like the others suggestions. I've found that TMySQLConnection.GetTableNames works like a charm, but that TMySQLConnection.GetTableNames fails with "The metadata is not available for this type of database." I would think the GetTableNames is more portable. So I will file a bug report against GetTableNames. Dave. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] How to allocate a 2D array?
Thanks all!This one works!Arjan>He wants 2D dynamic arrays, let's give him one:>type> TMyArray = array of array of Float;>var> MyArray: TMyArray;>begin> SetLength(MyArray,Width,Height); // Valid index now:>[0..Width-1,0..Height-1]> // Do something with MyArray> // No deallocation needed, the compiler does this for you>end;___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal] heap size growing
I've got a fairly large system (originally written in Delphi, then moved to Kylix, and now finally in FPC 2.2.2) which is doing a lot of different things. Various threads are running which execute reports, communiate with other devices, query data, process notifications, send and receive data on sockets, etc. For analysis of how its performing, I've got a thread which prints out the information from GetFPCHeapStatus every five minutes. What I notice is that CurrHeapUsed is not growing at all, it stays pretty much the same over hours of running. However, CurrHeapSize is pretty much continuously growing. For example (cu is current heap used, cs is current heap size, cf is current heap free, mu is max heap used, ms is max heap size): heap status: cu=1,407,664, cs=34,930,688, cf=33,523,024, mu=33,621,024, ms=35,749,888 heap status: cu=1,411,264, cs=66,715,648, cf=65,304,384, mu=33,635,232, ms=67,239,936 heap status: cu=1,409,296, cs=98,435,072, cf=97,025,776, mu=33,635,232, ms=98,467,840 heap status: cu=1,411,952, cs=161,873,920, cf=160,461,968, mu=33,674,176, ms=161,873,920 heap status: cu=1,409,056, cs=193,593,344, cf=192,184,288, mu=33,674,176, ms=193,593,344 heap status: cu=1,409,360, cs=193,593,344, cf=192,183,984, mu=33,674,176, ms=193,626,112 heap status: cu=1,409,552, cs=225,312,768, cf=223,903,216, mu=33,674,176, ms=225,345,536 heap status: cu=1,408,704, cs=257,032,192, cf=255,623,488, mu=33,674,176, ms=257,064,960 etc. top shows: PID USER PR NI VIRT RES SHR S %CPU %MEMTIME+ P COMMAND 15196 root 19 0 2323m 1.8g 2780 S0 24.6 0:00.68 4 processname free -m shows: total used free sharedbuffers cached Mem: 7611 7356254 0 66 5023 -/+ buffers/cache: 2266 5344 Swap: 4094 0 4094 If I were allocating memory and not deallocating it, ie., if it were a memory leak, it seems CurrHeapUsed would be growing, right? It seems I should be concerned... what's the best direction to go from here? HEAPTRC? -SG Computer over. Virus = very yes. Seth Grover sethdgrover[at]gmail[dot]com ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal