クラス org.objectweb.cjdbc.common.sql.InsertRequest

org.objectweb.cjdbc.common.sql.InsertRequestに対する継承グラフ

Inheritance graph
[凡例]
org.objectweb.cjdbc.common.sql.InsertRequestのコラボレーション図

Collaboration graph
[凡例]
すべてのメンバ一覧

説明

An InsertRequest is an SQL request of the following syntax:

  INSERT INTO table-name [(column-name[,column-name]*)] {VALUES (constant|null[,constant|null]*)}|{SELECT query}
 
VALUES are ignored. *
作者:
Emmanuel Cecchet
バージョン:
1.0

InsertRequest.java48 行で定義されています。

Public メソッド

 InsertRequest (String sqlQuery, boolean escapeProcessing, int timeout, String lineSeparator, DatabaseSchema schema, int granularity, boolean isCaseSensitive) throws SQLException
 InsertRequest (String sqlQuery, boolean escapeProcessing, int timeout, String lineSeparator)
void parse (DatabaseSchema schema, int granularity, boolean isCaseSensitive) throws SQLException
void cloneParsing (AbstractRequest request)
boolean isInsert ()
boolean isUpdate ()
boolean isDelete ()
boolean isCreate ()
boolean isDrop ()
void debug ()
boolean isAlter ()


コンストラクタとデストラクタ

org.objectweb.cjdbc.common.sql.InsertRequest.InsertRequest String  sqlQuery,
boolean  escapeProcessing,
int  timeout,
String  lineSeparator,
DatabaseSchema  schema,
int  granularity,
boolean  isCaseSensitive
throws SQLException
 

Creates a new InsertRequest instance. The caller must give an SQL request, without any leading or trailing spaces and beginning with 'insert into ' (it will not be checked).

If the syntax is incorrect an exception is thrown.

引数:
sqlQuery the SQL query
escapeProcessing should the driver to escape processing before sending to the database ?
timeout an int value
lineSeparator the line separator used in the query
schema a DatabaseSchema value
granularity parsing granularity as defined in ParsingGranularities
isCaseSensitive true if parsing is case sensitive
例外:
SQLException if an error occurs
InsertRequest.java68 行で定義されています。

参照先 org.objectweb.cjdbc.common.sql.InsertRequest.parse().

00071 { 00072 this(sqlQuery, escapeProcessing, timeout, lineSeparator); 00073 parse(schema, granularity, isCaseSensitive); 00074 }

org.objectweb.cjdbc.common.sql.InsertRequest.InsertRequest String  sqlQuery,
boolean  escapeProcessing,
int  timeout,
String  lineSeparator
 

Creates a new DropRequest instance. The caller must give an SQL request, without any leading or trailing spaces and beginning with 'create table ' (it will not be checked).

The request is not parsed but it can be done later by a call to parse(DatabaseSchema, int, boolean).

引数:
sqlQuery the SQL request
escapeProcessing should the driver to escape processing before sending to the database ?
timeout an int value
lineSeparator the line separator used in the query
参照:
parse
InsertRequest.java91 行で定義されています。
00093 { 00094 super(sqlQuery, escapeProcessing, timeout, lineSeparator); 00095 cacheable = RequestType.UNCACHEABLE; 00096 isParsed = false; 00097 }


メソッド

void org.objectweb.cjdbc.common.sql.InsertRequest.cloneParsing AbstractRequest  request  )  [virtual]
 

参照:
AbstractRequest.cloneParsing(AbstractRequest)

org.objectweb.cjdbc.common.sql.AbstractRequestを実装しています.

InsertRequest.java221 行で定義されています。

参照先 org.objectweb.cjdbc.common.sql.AbstractWriteRequest.cloneTableNameAndColumns(), と org.objectweb.cjdbc.common.sql.AbstractRequest.isParsed.

00222 { 00223 if (!request.isParsed()) 00224 return; 00225 cloneTableNameAndColumns((AbstractWriteRequest) request); 00226 isParsed = true; 00227 }

void org.objectweb.cjdbc.common.sql.InsertRequest.debug  ) 
 

Displays some debugging information about this request.

org.objectweb.cjdbc.common.sql.AbstractRequestを再定義しています。

InsertRequest.java277 行で定義されています。

00278 { 00279 super.debug(); 00280 if (tableName != null) 00281 System.out.println("Inserted table: " + tableName); 00282 else 00283 System.out.println("No information about inserted table"); 00284 00285 if (columns != null) 00286 { 00287 System.out.println("Inserted columns:"); 00288 for (int i = 0; i < columns.size(); i++) 00289 System.out.println(" " 00290 + ((TableColumn) columns.get(i)).getColumnName()); 00291 } 00292 else 00293 System.out.println("No information about inserted columns"); 00294 00295 System.out.println(""); 00296 }

boolean org.objectweb.cjdbc.common.sql.InsertRequest.isAlter  )  [virtual]
 

参照:
org.objectweb.cjdbc.common.sql.AbstractWriteRequest.isAlter()

org.objectweb.cjdbc.common.sql.AbstractWriteRequestを実装しています.

InsertRequest.java300 行で定義されています。

00301 { 00302 return false; 00303 }

boolean org.objectweb.cjdbc.common.sql.InsertRequest.isCreate  )  [virtual]
 

戻り値:
false
参照:
org.objectweb.cjdbc.common.sql.AbstractWriteRequest.isCreate()

org.objectweb.cjdbc.common.sql.AbstractWriteRequestを実装しています.

InsertRequest.java260 行で定義されています。

00261 { 00262 return false; 00263 }

boolean org.objectweb.cjdbc.common.sql.InsertRequest.isDelete  )  [virtual]
 

戻り値:
false
参照:
org.objectweb.cjdbc.common.sql.AbstractWriteRequest.isDelete()

org.objectweb.cjdbc.common.sql.AbstractWriteRequestを実装しています.

InsertRequest.java251 行で定義されています。

00252 { 00253 return false; 00254 }

boolean org.objectweb.cjdbc.common.sql.InsertRequest.isDrop  )  [virtual]
 

戻り値:
false
参照:
org.objectweb.cjdbc.common.sql.AbstractWriteRequest.isDrop()

org.objectweb.cjdbc.common.sql.AbstractWriteRequestを実装しています.

InsertRequest.java269 行で定義されています。

00270 { 00271 return false; 00272 }

boolean org.objectweb.cjdbc.common.sql.InsertRequest.isInsert  )  [virtual]
 

戻り値:
true
参照:
org.objectweb.cjdbc.common.sql.AbstractWriteRequest.isInsert()

org.objectweb.cjdbc.common.sql.AbstractWriteRequestを実装しています.

InsertRequest.java233 行で定義されています。

00234 { 00235 return true; 00236 }

boolean org.objectweb.cjdbc.common.sql.InsertRequest.isUpdate  )  [virtual]
 

戻り値:
false
参照:
org.objectweb.cjdbc.common.sql.AbstractWriteRequest.isUpdate()

org.objectweb.cjdbc.common.sql.AbstractWriteRequestを実装しています.

InsertRequest.java242 行で定義されています。

00243 { 00244 return false; 00245 }

void org.objectweb.cjdbc.common.sql.InsertRequest.parse DatabaseSchema  schema,
int  granularity,
boolean  isCaseSensitive
throws SQLException [virtual]
 

TODO: extraction of the selected columns

参照:
org.objectweb.cjdbc.common.sql.AbstractRequest.parse(org.objectweb.cjdbc.common.sql.schema.DatabaseSchema, int, boolean)

org.objectweb.cjdbc.common.sql.AbstractRequestを実装しています.

InsertRequest.java105 行で定義されています。

参照先 org.objectweb.cjdbc.common.sql.schema.DatabaseTable.getColumn(), org.objectweb.cjdbc.common.sql.schema.DatabaseTable.getColumns(), org.objectweb.cjdbc.common.sql.schema.DatabaseColumn.getName(), と org.objectweb.cjdbc.common.sql.schema.DatabaseTable.getName().

参照元 org.objectweb.cjdbc.common.sql.InsertRequest.InsertRequest().

00107 { 00108 if (granularity == ParsingGranularities.NO_PARSING) 00109 { 00110 isParsed = true; 00111 return; 00112 } 00113 00114 // Sanity check 00115 if (schema == null) 00116 throw new SQLException( 00117 "Unable to parse request with an undefined database schema"); 00118 00119 String originalSQL = this.trimCarriageReturn(); 00120 String sql = originalSQL.toLowerCase(); 00121 00122 // Strip 'insert into ' 00123 sql = sql.substring(7).trim().substring(5).trim(); 00124 00125 // Look for the VALUES or SELECT clause 00126 int endIdx = sql.indexOf("values "); 00127 if (endIdx == -1) 00128 { 00129 endIdx = sql.indexOf("values("); 00130 if (endIdx == -1) 00131 { 00132 endIdx = sql.indexOf("select "); 00133 if (endIdx == -1) 00134 throw new SQLException( 00135 "Unable to find the VALUES or SELECT keyword in this INSERT statement: '" 00136 + sqlQuery + "'"); 00137 } 00138 } 00139 00140 if (isCaseSensitive) 00141 { 00142 int shift = originalSQL.length() - sql.length(); 00143 sql = originalSQL.substring(shift, shift + endIdx).trim(); 00144 } 00145 else 00146 sql = sql.substring(0, endIdx).trim(); 00147 00148 int openParenthesisIdx = sql.indexOf("("); 00149 00150 // Get the table on which INSERT occurs 00151 String insertTable; 00152 if (openParenthesisIdx == -1) 00153 insertTable = sql; 00154 else 00155 insertTable = sql.substring(0, openParenthesisIdx).trim(); 00156 00157 DatabaseTable t = schema.getTable(insertTable, isCaseSensitive); 00158 if (t == null) 00159 throw new SQLException("Unknown table '" + insertTable 00160 + "' in this INSERT statement: '" + sqlQuery + "'"); 00161 else 00162 tableName = t.getName(); 00163 00164 if ((granularity == ParsingGranularities.COLUMN) 00165 || (granularity == ParsingGranularities.COLUMN_UNIQUE)) 00166 { 00167 if (openParenthesisIdx != -1) 00168 { 00169 // Fetch the affected columns 00170 int closingParenthesisIdx = sql.indexOf(")"); 00171 if ((closingParenthesisIdx == -1) || (closingParenthesisIdx > endIdx)) 00172 { 00173 tableName = null; 00174 columns = null; 00175 throw new SQLException( 00176 "Syntax error in columns definition for this INSERT statement: '" 00177 + sqlQuery + "'"); 00178 } 00179 00180 // Column names are separated by comas 00181 StringTokenizer columnTokens = new StringTokenizer(sql.substring( 00182 openParenthesisIdx + 1, closingParenthesisIdx), ","); 00183 columns = new ArrayList(); 00184 DatabaseColumn col = null; 00185 while (columnTokens.hasMoreTokens()) 00186 { 00187 String token = columnTokens.nextToken().trim(); 00188 if ((col = t.getColumn(token)) == null) 00189 { 00190 tableName = null; 00191 columns = null; 00192 throw new SQLException("Unknown column name '" + token 00193 + "' in this INSERT statement: '" + sqlQuery + "'"); 00194 } 00195 else 00196 { 00197 columns.add(new TableColumn(tableName, col.getName())); 00198 } 00199 } 00200 } 00201 else 00202 { 00203 // All columns are affected 00204 columns = new ArrayList(); 00205 ArrayList cols = t.getColumns(); 00206 int size = cols.size(); 00207 for (int j = 0; j < size; j++) 00208 { 00209 columns.add(new TableColumn(tableName, ((DatabaseColumn) cols.get(j)) 00210 .getName())); 00211 } 00212 } 00213 } 00214 00215 isParsed = true; 00216 }


このクラスの説明は次のファイルから生成されました:
CJDBCversion1.0.4に対してTue Oct 12 15:16:17 2004に生成されました。 doxygen 1.3.8