reserved-words

Is it possible to “escape” a method name in PHP, to be able to have a method name that clashes with a reserved keyword?

喜你入骨 提交于 2019-12-01 19:23:28
I'm doing MVC in PHP, and i'd like to have a list() method inside my Controller, to have the URL /entity/list/parent_id, to show all the "x" that belong to that parent. However, I can't have a method called list(), since it's a PHP reserved keyword. In VB.Net, for example, if I need to have something with a name that clashes with a reserved keyword, I can wrap it in [reserved_name]. In SQL, you can do the same thing. In MySQL, you use the backtick ` Is there some syntax in PHP that specifies "treat this as an identifier, not as a keyword"? (NOTE: I know I can use routes to do this without

How do I put backticks in a column name called key for hibernate

淺唱寂寞╮ 提交于 2019-12-01 18:37:28
I have a MySQL DB table which I cannot modify but have to insert values into. It has a column called key which I need to insert into. Now, my .hbm.xml file has: <property name="key" type="string" column="key" /> The insert query generated hence fails. On adding [key], the generated SQL now contained key but this also failed. On checking in MYSql Workbench, I found that key can work. However, if I change this in the file mentioned above, it reverts to the "key" as when using [key]. Can someone guide me as to how I can add key and bring about the required insert? There is a hibernate

Sqlite3 activerecord :order => “time DESC” doesn't sort

女生的网名这么多〃 提交于 2019-12-01 06:21:46
rails 2.3.4, sqlite3 I'm trying this Production.find(:all, :conditions => ["time > ?", start_time.utc], :order => "time DESC", :limit => 100) The condition works perfectly, but I'm having problems with the :order => time DESC . By chance, I discovered that it worked at Heroku (testing with heroku console), which runs PostgreSQL. However, locally, using sqlite3, new entries will be sorted after old ones, no matter what I set time to. Like this ( output has been manually stripped ): second entry is new: Production id: 2053939460, time: "2010-04-24 23:00:04", created_at: "2010-04-24 23:00:05"

What exactly does the T-SQL “LineNo” reserved word do?

十年热恋 提交于 2019-11-30 05:42:10
I was writing a query against a table today on a SQL Server 2000 box, and while writing the query in Query Analyzer, to my surprise I noticed the word LineNo was converted to blue text. It appears to be a reserved word according to MSDN documentation, but I can find no information on it, just speculation that it might be a legacy reserved word that doesn't do anything. I have no problem escaping the field name, but I'm curious -- does anyone know what "LineNo" in T-SQL is actually used for? OK, this is completely undocumented, and I had to figure it out via trial and error, but it sets the

MySQL, safely using reserved word in query [duplicate]

南楼画角 提交于 2019-11-29 12:37:20
This question already has an answer here: Syntax error due to using a reserved word as a table or column name in MySQL 1 answer I need to return a multidimensional array from a query with the id keys named key . (needed for object keys in amazon S3 API) example: Array ( [0] => Array ( [key] => 8 ) [1] => Array ( [key] => 7 ) [2] => Array ( [key] => 6 ) ) The problem: key is a reserved name in MySQL. I have to use the name key. The following query gives an error SELECT `file_name` AS key FROM (`uploads`) but adding backticks around key doesn't give errors SELECT `file_name` AS `key` FROM (

What exactly does the T-SQL “LineNo” reserved word do?

雨燕双飞 提交于 2019-11-29 04:46:02
问题 I was writing a query against a table today on a SQL Server 2000 box, and while writing the query in Query Analyzer, to my surprise I noticed the word LineNo was converted to blue text. It appears to be a reserved word according to MSDN documentation, but I can find no information on it, just speculation that it might be a legacy reserved word that doesn't do anything. I have no problem escaping the field name, but I'm curious -- does anyone know what "LineNo" in T-SQL is actually used for?

Is 'event' a reserved word in JavaScript?

坚强是说给别人听的谎言 提交于 2019-11-28 22:38:25
I am a beginner to Javascript. And when I was practicing I have noticed something. Take this function: <script type="text/javascript"> function showChar(sSomeData, oEvent) { alert (oEvent.keyCode); return true; } </script> When I call this function as this: <input type="text" id="txtTextBox" onkeypress="return showChar('some text', oEvent);" /> I get a JS error: "Microsoft JScript runtime error: 'oEvent' is undefined" But if I rename oEvent with 'event' like: <input type="text" id="txtTextBox" onkeypress="return showChar('some text', event);" /> Then it works fine. My conclusion is 'event'is a

What is the difference between “keyword” and “reserved word”?

房东的猫 提交于 2019-11-28 17:44:50
What's the difference between a keyword and a reserved word ? For example, in the proposal for concepts in C++ one can read the following statement: This proposal introduces five new keywords: concept, concept map, where, axiom, and late check. All of these keywords will also be reserved words. Keywords have a special meaning in a language, and are part of the syntax. Reserved words are words that cannot be used as identifiers (variables, functions, etc.), because they are reserved by the language. In practice most keywords are reserved words and vice versa. But because they're two different

PHP reserved words as namespaces and class names

拟墨画扇 提交于 2019-11-28 13:57:06
Recently I've started converting my framework to use the php namespaces and one question to which I can't seem to find the answer is - is it 'legal' to use reserved words such as 'Object', 'Array', 'String' as namespace and class name within that namespace? An example would be: namespace System\Object; class String { } class Array { } PHP will throw an error like: Parse error: syntax error, unexpected T_ARRAY, expecting T_STRING if you try: class Array { } $myClass = new Array; Instead, try something like class myArray { } $myClass = new myArray; [edit] I'll elaborate on that a little, they're

All reserved words of every DBMS [closed]

随声附和 提交于 2019-11-28 09:57:08
I'm designing a database. Now it's on MySQL, but tomorrow could migrate on another DBMS. So I have to pay attention not to use reserved words (for MySQL and possibly for any other DBMS) as field names. And I don't want to use reserved word as field names, wrapped in quotes or square brackets! Is there a site where I can find all reserved words for every DBMS? Or at least for the most used ones. It would be great if would exist a tool where you put a word and it gives you all DBMS for which it is a reserved word, if any. If there is no online reference or tool of this kind, we could recollect a