36 sbColumnInfo* ci = mOutputColumns.AppendElement();
37 NS_ENSURE_TRUE(ci, NS_ERROR_OUT_OF_MEMORY);
39 ci->tableName = EmptyString();
40 ci->columnName = aColumnName;
46 sbSQLInsertBuilder::AddValueString(
const nsAString&
aValue)
48 sbValueItem* vi = mValueList.AppendElement();
49 NS_ENSURE_TRUE(vi, NS_ERROR_OUT_OF_MEMORY);
58 sbSQLInsertBuilder::AddValueLong(PRInt32 aValue)
60 sbValueItem* vi = mValueList.AppendElement();
61 NS_ENSURE_TRUE(vi, NS_ERROR_OUT_OF_MEMORY);
63 vi->type = eInteger32;
70 sbSQLInsertBuilder::AddValueNull()
72 sbValueItem* vi = mValueList.AppendElement();
73 NS_ENSURE_TRUE(vi, NS_ERROR_OUT_OF_MEMORY);
81 sbSQLInsertBuilder::AddValueParameter()
83 sbValueItem* vi = mValueList.AppendElement();
84 NS_ENSURE_TRUE(vi, NS_ERROR_OUT_OF_MEMORY);
86 vi->type = eIsParameter;
92 sbSQLInsertBuilder::AddValueRaw(
const nsAString& aValue)
94 sbValueItem* vi = mValueList.AppendElement();
95 NS_ENSURE_TRUE(vi, NS_ERROR_OUT_OF_MEMORY);
104 sbSQLInsertBuilder::GetIntoTableName(nsAString& aIntoTableName)
106 aIntoTableName = mIntoTableName;
110 sbSQLInsertBuilder::SetIntoTableName(
const nsAString& aIntoTableName)
112 mIntoTableName = aIntoTableName;
119 NS_ADDREF(*aSelect = mSelect);
134 mOutputColumns.Clear();
144 buff.AssignLiteral(
"insert into ");
146 buff.Append(mIntoTableName);
148 PRUint32 len = mOutputColumns.Length();
150 buff.AppendLiteral(
" (");
151 for (PRUint32
i = 0;
i < len;
i++) {
155 buff.AppendLiteral(
", ");
158 buff.AppendLiteral(
")");
163 rv = mSelect->ToString(sql);
164 NS_ENSURE_SUCCESS(rv, rv);
165 buff.AppendLiteral(
" ");
169 buff.AppendLiteral(
" values (");
170 len = mValueList.Length();
171 for (PRUint32
i = 0;
i < len;
i++) {
172 const sbValueItem& vi = mValueList[
i];
176 buff.AppendLiteral(
"null");
179 buff.AppendLiteral(
"?");
183 nsAutoString escapedValue(vi.stringValue);
186 buff.AppendLiteral(
"'");
187 buff.Append(escapedValue);
188 buff.AppendLiteral(
"'");
192 buff.AppendInt(vi.int32Value);
195 buff.Append(vi.stringValue);
200 buff.AppendLiteral(
", ");
204 buff.AppendLiteral(
")");
207 _retval.Assign(buff);
nsresult SB_EscapeSQL(nsAString &str)
NS_DECL_SBISQLINSERTBUILDER NS_IMETHOD ToString(nsAString &_retval)
Interface for building SELECT statements.
NS_IMPL_ISUPPORTS_INHERITED1(sbSQLInsertBuilder, sbSQLBuilderBase, sbISQLInsertBuilder) NS_IMETHODIMP sbSQLInsertBuilder
_getSelectedPageStyle s i
Interface for building INSERT statements.